Javascript methods for the summary page.
- Source:
Methods
(inner) checkCheckBoxes()
Checks what checkboxes user has selected and performs action if specific
checkbox is selected
- Source:
(inner) convertMsToStr(ms) → {string}
Converts the time in milliseconds to a string hh:mm:ss.
Parameters:
Name | Type | Description |
---|---|---|
ms |
number | The time in milliseconds. |
- Source:
Returns:
- The time in string as hh:mm:ss.
- Type
- string
(inner) convertMsToUnits(ms) → {string}
Converts the time in milliseconds to a string with the time units e.g. 1h 2m
0s.
Parameters:
Name | Type | Description |
---|---|---|
ms |
number | The time in milliseconds. |
- Source:
Returns:
- The time in string with units e.g. 1h 2m 0s.
- Type
- string
(inner) convertStrToMs(str) → {number}
Converts the time string in the form hh:mm:ss to milliseconds.
Parameters:
Name | Type | Description |
---|---|---|
str |
string | The time in a string as hh:mm:ss. |
- Source:
Returns:
- The time in milliseconds or NaN for unparseable time
string.
- Type
- number
(inner) createRecordRow(record) → {object}
Creates a HTML element containing the data of a record.
Parameters:
Name | Type | Description |
---|---|---|
record |
object | The object contains record data in the form: {name, count, countPercentage, duration, durationPercentage} |
- Source:
Returns:
- The jquery object containing the record row element.
- Type
- object
(inner) encodeHTML(str) → {str}
Encodes HTML markup characters to HTML entities.
Parameters:
Name | Type | Description |
---|---|---|
str |
string | The string to be encoded. |
- Source:
Returns:
- The encoded string.
- Type
- str
(inner) getDurationOfCategories(records, timeframe) → {number}
Get total duration of records of all categories in given time frame.
Parameters:
Name | Type | Description |
---|---|---|
records |
object | object containing the records. |
timeframe |
object | The selected start and end time. |
- Source:
Returns:
- duration of the records.
- Type
- number
(inner) getDurationOfRecords(records) → {number}
Gets the total duration of the records in the given time frame.
Parameters:
Name | Type | Description |
---|---|---|
records |
object | The object containing the records. |
- Source:
Returns:
- The duration of the records.
- Type
- number
(inner) getLocalZeroDate() → {date}
Gets the "zero" date with the time zone offset.
- Source:
Returns:
- The zero date with the time zone offset.
- Type
- date
(inner) getRecordDetails(record) → {string}
Gets the record details as a string.
Parameters:
Name | Type | Description |
---|---|---|
record |
object | The record object from the timeline component. |
- Source:
Returns:
- The details as a string value.
- Type
- string
(inner) getRecordsInTimeframe(records, timeframe) → {object}
Gets all the records that are fully or partially in the given time frame.
Parameters:
Name | Type | Description |
---|---|---|
records |
object | The object containing the records. |
timeframe |
object | The selected start and end time. |
- Source:
Returns:
- returns a list of matched records.
- Type
- object
(inner) getTimeframeDuration(timeframe) → {number}
Gets the duration of the given time frame.
Parameters:
Name | Type | Description |
---|---|---|
timeframe |
object | The selected start and end time. |
- Source:
Returns:
- duration of the observation's time frame.
- Type
- number
(inner) hideMessages(timeline, growl)
Hides all growl messages and removes timeline selection.
Parameters:
Name | Type | Description |
---|---|---|
timeline |
object | The timeline component. |
growl |
object | The growl component. |
- Source:
(inner) isBottomOfDocument(padding) → {boolean}
Checks if the user has scrolled to the bottom of the page.
Parameters:
Name | Type | Description |
---|---|---|
padding |
number | An extra padding to be checked. |
- Source:
Returns:
- true if at bottom otherwise false.
- Type
- boolean
(inner) leadingZero(n) → {string}
Returns the given number as a string and appends a leading zero to it if the
number is a single digit number.
Parameters:
Name | Type | Description |
---|---|---|
n |
number | The given number. |
- Source:
Returns:
- number with possible leading zero.
- Type
- string
(inner) percentOf(a, b) → {number}
Calculates the percentage of two values.
Parameters:
Name | Type | Description |
---|---|---|
a |
number | The number of share. |
b |
number | The number of total quantity. |
- Source:
Returns:
- percentage ratio.
- Type
- number
(inner) saveAsImage()
Saves the canvas as png.
- Source:
(inner) saveImage()
Creates canvas element where the timeline and datatable are inserted
sends the created image through ajax to Java
- Source:
(inner) sendImage(URI)
Sends the given string to the servlet that expects a base64-encoded png
Parameters:
Name | Type | Description |
---|---|---|
URI |
The base64-encoded png-file |
- Source:
(inner) showRecordDetails(timeline, growl)
Shows a PrimeFaces growl message with details of the selected record.
Parameters:
Name | Type | Description |
---|---|---|
timeline |
object | The timeline component. |
growl |
object | The growl component. |
- Source:
(inner) spanPercentOf(a, b) → {string}
Gets the percentage of two values as a span element string.
Parameters:
Name | Type | Description |
---|---|---|
a |
number | The number of share. |
b |
number | The number of total quantity. |
- Source:
Returns:
- percent as span element string.
- Type
- string
(inner) toTimelineTime(date) → {number}
Converts the date object to the timeline component time.
Parameters:
Name | Type | Description |
---|---|---|
date |
date | The date object of the time to be converted. |
- Source:
Returns:
- The converted time in milliseconds.
- Type
- number
(inner) updateRecordsTable(timeline, timeframe)
Updates the records table information according to the given time frame.
Parameters:
Name | Type | Description |
---|---|---|
timeline |
object | The timeline component. |
timeframe |
object | The selected start and end time. |
- Source:
(inner) updateTimelineTimeframe(timeline, strStart, strEnd) → {boolean}
Updates the time frame of the timeline to the given start and end times.
Parameters:
Name | Type | Description |
---|---|---|
timeline |
object | The timeline component. |
strStart |
string | The time frame starting time in hh:mm:ss format. |
strEnd |
string | The time frame ending time in hh:mm:ss format. |
- Source:
Returns:
- returns true on errors, false if updated successfully.
- Type
- boolean