Yahoo! UI Library

Diary widget  1.4

Yahoo! UI Library > diary > DiaryItem
Search:
 
Filters

Class DiaryItem - extends YAHOO.util.Resize

DiaryItem class for individual items in the Diary.

Data and display for particular diary item. Extends resize (and includes drag drop). This class shouldn't be used directly; items to be added should be added by the Diary.addItem() method.

Properties

anim - YAHOO.util.Anim

For animating movement on drag drop
Default Value: : false

dragdrop - YAHOO.util.DragDrop

The YAHOO.util.DD instance. We don't use the built-in one with Resize because some events don't come through properly.
Default Value: null

TIME_SEPARATOR - {String}

String that separates hours and minutes
Default Value: ":"

Methods

_handleBeforeStartDrag

protected void _handleBeforeStartDrag ( ev )
Fires an event and stops the drag if subscriber returns false
Parameters:
ev <HTMLEvent> The before start drag event
Returns: void

_handleDiaryDragEnter

protected void _handleDiaryDragEnter ( ev , String )
While entering a day, update this item's current day
Parameters:
ev <Event>
String <object> Id passed by dragenter event
Returns: void

_handleDiaryDragOver

protected void _handleDiaryDragOver ( ev )
While dragging over a day, update this item's current time and display it
Parameters:
ev <object> Event
Returns: void

_handleDiaryEndDrag

protected void _handleDiaryEndDrag ( ev )
At the end, update times and days and re-render
Parameters:
ev <object> Event
Returns: void

_handleDiaryStartDrag

protected void _handleDiaryStartDrag ( )
Start dragging handler. Caches dates, sets Anim if needed.
Returns: void

addCategory

void addCategory ( category , caseSensitive )
Adds a category to the existing ones, if it's not there already (using default case insensitive match
Parameters:
category <String> Category string to check
caseSensitive <Boolean> Whether to do case-sensitive match
Returns: void

addMultiDayChild

void addMultiDayChild ( oDiaryItem )
Adds a linked child diary item to the stack:
Parameters:
oDiaryItem <DiaryItem>
Returns: void

calcEndFromPosition

Int calcEndFromPosition ( )
Calculate the end time (seconds) based on position
Returns: Int

calcStartFromPosition

Int calcStartFromPosition ( )
Calculate the start time (seconds) based on position
Returns: Int

calculateHeight

Int calculateHeight ( )
Calculate the height (in pixels) of this based on times
Returns: Int

calculateTop

Int calculateTop ( )
Calculate the top (in pixels) of this based on times
Returns: Int

destroy

void destroy ( )
Destroys the DiaryItem
Returns: void

getDiary

YAHOO.widget.Diary getDiary ( )
Returns Diary instance we're in.
Returns: YAHOO.widget.Diary

getDisplayEndTimeSecs

protected Int getDisplayEndTimeSecs ( )
Gets the displayed end time as seconds from 00:00
Returns: Int

getDisplayStartTimeSecs

protected Int getDisplayStartTimeSecs ( )
Gets the displayed start time as seconds from 00:00
Returns: Int

getEndTimeSecs

Int getEndTimeSecs ( )
Gets the end time as seconds from 00:00
Returns: Int

getParentItem

DiaryItem getParentItem ( )
Provides access to the parent item. For single-day events, it's this, for multi-day events it's the parent, which will give proper dates/times etc and ids for editing and so on.
Returns: DiaryItem

getStartTimeDay

Int getStartTimeDay ( )
Gets the start time ( milliseconds) of the day of this item (ie at 00:00)
Returns: Int

getStartTimeSecs

Int getStartTimeSecs ( )
Gets the start time as seconds from 00:00
Returns: Int

hasCategory

Boolean hasCategory ( category , caseSensitive )
Checks if Item has category passed.
Parameters:
category <String> Category string to check
caseSensitive <Boolean> Whether to do case-sensitive match (default false)
Returns: Boolean

initContent

protected void initContent ( el )
Initializer, sets up the details Element
Parameters:
el <HTMLElement|String> Element passed to constructor
Returns: void

initListeners

protected void initListeners ( )
Initialize listeners for this item.
Returns: void

render

void render ( Object )
Render the item
Parameters:
Object < width: Int, linesInBlock: Int> Containing some dimensions
Returns: void

renderDetails

void renderDetails ( Whether )
Writes the text to the this._detailsEl element
Parameters:
Whether <Boolean> to use the item's parent (if a multi-day item)
Returns: void

renderEndTime

String renderEndTime ( )
Gets end time as string
Returns: String

renderFullDetails

String renderFullDetails ( )
Returns a string showing full details of the item.
Returns: String

renderStartTime

String renderStartTime ( )
Gets start time as string hh:mm format
Returns: String

setEndTimeDay

void setEndTimeDay ( Date )
Sets the end day/month/year of this item
Parameters:
Date <Object> to extract date/month/year from
Returns: void

setEndTimeSecs

void setEndTimeSecs ( Int )
Sets the end time (but not date) from seconds
Parameters:
Int <object>
Returns: void

setLine

void setLine ( Int )
Which 'line' (ie what offset) is this one in?
Parameters:
Int <object>
Returns: void

setStartTimeDay

void setStartTimeDay ( Date )
Sets the start day/month/year of this item (but not times)
Parameters:
Date <Object> to extract date/month/year from
Returns: void

setStartTimeSecs

void setStartTimeSecs ( Int )
Sets the start time (but not date) from seconds
Parameters:
Int <object>
Returns: void

Events

_displayDTENDChange

_displayDTENDChange ( event )
Fires when the value for the configuration attribute '_displayDTEND' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

_displayDTSTARTChange

_displayDTSTARTChange ( event )
Fires when the value for the configuration attribute '_displayDTSTART' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

backClassChange

backClassChange ( event )
Fires when the value for the configuration attribute 'backClass' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

before_displayDTENDChange

before_displayDTENDChange ( event )
Fires before the value for the configuration attribute '_displayDTEND' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

before_displayDTSTARTChange

before_displayDTSTARTChange ( event )
Fires before the value for the configuration attribute '_displayDTSTART' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeBackClassChange

beforeBackClassChange ( event )
Fires before the value for the configuration attribute 'backClass' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeBlockChange

beforeBlockChange ( event )
Fires before the value for the configuration attribute 'block' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeCATEGORIESChange

beforeCATEGORIESChange ( event )
Fires before the value for the configuration attribute 'CATEGORIES' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeColumnChange

beforeColumnChange ( event )
Fires before the value for the configuration attribute 'column' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeDESCRIPTIONChange

beforeDESCRIPTIONChange ( event )
Fires before the value for the configuration attribute 'DESCRIPTION' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeDetailClassChange

beforeDetailClassChange ( event )
Fires before the value for the configuration attribute 'detailClass' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeDTENDChange

beforeDTENDChange ( event )
Fires before the value for the configuration attribute 'DTEND' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeDTSTARTChange

beforeDTSTARTChange ( event )
Fires before the value for the configuration attribute 'DTSTART' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeLOCATIONChange

beforeLOCATIONChange ( event )
Fires before the value for the configuration attribute 'LOCATION' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeMultiDayParentChange

beforeMultiDayParentChange ( event )
Fires before the value for the configuration attribute 'multiDayParent' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeMultiDayPositionChange

beforeMultiDayPositionChange ( event )
Fires before the value for the configuration attribute 'multiDayPosition' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforePxPerHourChange

beforePxPerHourChange ( event )
Fires before the value for the configuration attribute 'pxPerHour' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeSUMMARYChange

beforeSUMMARYChange ( event )
Fires before the value for the configuration attribute 'SUMMARY' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeUIDChange

beforeUIDChange ( event )
Fires before the value for the configuration attribute 'UID' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeURLChange

beforeURLChange ( event )
Fires before the value for the configuration attribute 'URL' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeUseAnimationChange

beforeUseAnimationChange ( event )
Fires before the value for the configuration attribute 'useAnimation' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeUseCssCategoriesChange

beforeUseCssCategoriesChange ( event )
Fires before the value for the configuration attribute 'useCssCategories' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeVisibleChange

beforeVisibleChange ( event )
Fires before the value for the configuration attribute 'visible' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

blockChange

blockChange ( event )
Fires when the value for the configuration attribute 'block' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

CATEGORIESChange

CATEGORIESChange ( event )
Fires when the value for the configuration attribute 'CATEGORIES' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

columnChange

columnChange ( event )
Fires when the value for the configuration attribute 'column' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

DESCRIPTIONChange

DESCRIPTIONChange ( event )
Fires when the value for the configuration attribute 'DESCRIPTION' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

destroy

destroy ( )
Fired after destruction process

detailClassChange

detailClassChange ( event )
Fires when the value for the configuration attribute 'detailClass' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

DTENDChange

DTENDChange ( event )
Fires when the value for the configuration attribute 'DTEND' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

DTSTARTChange

DTSTARTChange ( event )
Fires when the value for the configuration attribute 'DTSTART' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

itemBeforeEndMove

itemBeforeEndMove ( oArgs.from , oArgs.to , oArgs.item , oArgs.originEvent )
fired when an item is moved or resized (ie the times change). Return false to cancel the resize/move
Parameters:
oArgs.from <object> Object literal containing original DTSTART and DTEND
oArgs.to <object> Object literal containing final DTSTART and DTEND
oArgs.item <object> DiaryItem that's being moved
oArgs.originEvent <object> Original event from resize/dragdrop passed through.

itemBeforeStartMove

itemBeforeStartMove ( oArgs.item , oArgs.originEvent )
Fired before everything starts moving. Return false to cancel move.
Parameters:
oArgs.item <object> DiaryItem that's about to be moved.
oArgs.originEvent <object> Original event from resize/dragdrop passed through.

itemEndMove

itemEndMove ( oArgs.from , oArgs.to , oArgs.item , oArgs.originEvent )
fired when an item is moved or resized (ie the times change)
Parameters:
oArgs.from <object> Object literal containing original DTSTART and DTEND
oArgs.to <object> Object literal containing final DTSTART and DTEND
oArgs.item <object> DiaryItem that's being moved
oArgs.originEvent <object> Original event from resize/dragdrop passed through.

LOCATIONChange

LOCATIONChange ( event )
Fires when the value for the configuration attribute 'LOCATION' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

multiDayParentChange

multiDayParentChange ( event )
Fires when the value for the configuration attribute 'multiDayParent' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

multiDayPositionChange

multiDayPositionChange ( event )
Fires when the value for the configuration attribute 'multiDayPosition' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

pxPerHourChange

pxPerHourChange ( event )
Fires when the value for the configuration attribute 'pxPerHour' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

SUMMARYChange

SUMMARYChange ( event )
Fires when the value for the configuration attribute 'SUMMARY' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

UIDChange

UIDChange ( event )
Fires when the value for the configuration attribute 'UID' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

URLChange

URLChange ( event )
Fires when the value for the configuration attribute 'URL' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

useAnimationChange

useAnimationChange ( event )
Fires when the value for the configuration attribute 'useAnimation' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

useCssCategoriesChange

useCssCategoriesChange ( event )
Fires when the value for the configuration attribute 'useCssCategories' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

visibleChange

visibleChange ( event )
Fires when the value for the configuration attribute 'visible' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

Configuration Attributes

backClass - String class name to add

Adds css class(es) to the background Item container
Default Value: ""

block - Object DiaryBlock

Reference to the block (ie group of items) this item is in

CATEGORIES - String

Comma separated string of categories for this Item. If useCssCategories is true these will be added as css classes (with hyphens replacing spaces.
Default Value: ''

column - Object DiaryDay

Reference to the column (ie day) this item is in

DESCRIPTION - String

Full text displayed on diary
Default Value: ""

detailClass - String class name to add

Adds css class(es) to the text div container Item container
Default Value: ""

DTEND - Object Date object

End time/ date

DTSTART - Object Date object

Start time/ date

LOCATION - String

Default Value: : ''

pxPerHour - Number

Number of pixels per hour
Default Value: : 20

SUMMARY - String

Summary text displayed on diary

UID - object

The unique id of the item. Write once.
Default Value: : ''

URL - String

URL data for item

useAnimation - Boolean

Whether to use animation after drag drops
Default Value: false

useCssCategories - Boolean

If true, any CATEGORIES will be added as css classes to the container element for the item, allowing styling and filtering. Anything passed to backClass will also be added. Spaces in categories will be changed to hyphens.
Default Value: false

visible - Number

Whether this should be displayed or not
Default Value: : 20


Copyright © 2010 Yahoo! Inc. All rights reserved.