Class jMatrixBrowseNs.jMatrixBrowseRenderer
jMatrixBrowseRenderer
Defined in: jMatrixBrowseRenderer.js.
Constructor Attributes | Constructor Name and Description |
---|---|
jMatrixBrowseNs.jMatrixBrowseRenderer(elem, configuration, api)
jMatrixBrowse Renderer manages the rendering of elements as well as row and
column headers.
|
Method Attributes | Method Name and Description |
---|---|
<inner> |
cellClickHandler(elem, event)
Function that handles the click event on cell elements.
|
<inner> |
checkPositionBounds(newPosition, changeInPosition, draggable)
Checks the bounds for the matirx from four directions to find if the bounds are violated and returns the new positions.
|
<inner> |
checkScrollBounds(direction)
Checks if the bounds for scrolling matrix are valid.
|
<inner> |
cleanup()
Removes all the DOM elements created by jMatrixBrowseRenderer.
|
<inner> |
createContentDiv(container)
Create the content div and append to container.
|
<inner> |
createDragContainer(container)
Create the drag container and make it draggable.
|
<inner> |
createRowColumnHeaderContainer(container)
Create the row and column header containers.
|
<inner> |
dragHandler(event, ui)
Function that handles the drag event on dragContainer.
|
<inner> |
dragStartHandler(event, ui)
Function that handles the drag start event on dragContainer.
|
<inner> |
dragStopHandler(event, ui)
Function that handles the drag stop event on dragContainer.
|
<inner> |
generateClassNameForCell(row, col)
Generate class name for given cell position.
|
<inner> |
generateColHeaders(header)
Generates elements and appends them to column header container.
|
<inner> |
generateInitialMatrixContent(container)
Creates an empty matrix with size obtained from API and appends to content.
|
<inner> |
generatePositionsForDrag(draggable, event)
Generate new positions of the draggable element.
|
<inner> |
generateRowColumnHeaders(headers)
Creates an empty matrix with size obtained from API and appends to content.
|
<inner> |
generateRowHeaders(header)
Generates elements and appends them to row header container.
|
Gets the cell elements.
|
|
<inner> |
getCellPosition(row, col)
Get the cell position for cell at (row,col).
|
<inner> |
Finds the cell that is closest to the top left boundaries.
|
Gets the container for jMatrixBrowse.
|
|
Gets the row and column headers.
|
|
<inner> |
getNumberOfColsForPageScroll(direction)
Gets the number of cols that can be scrolled for a page left/right event without violating the matrix bounds.
|
<inner> |
getNumberOfRowsForPageScroll(direction)
Gets the number of rows that can be scrolled for a page up/down event without violating the matrix bounds.
|
<inner> |
init(windowPosition)
Initializes the jMatrixBrowseRenderer component.
|
moveColToLeft(col)
Moves a column to left.
|
|
moveColToRight(col)
Moves a column to right.
|
|
moveRowToEnd(row)
Moves the row to bottom.
|
|
moveRowToTop(row)
Moves the row to top.
|
|
pageDown()
Scrolls the matrix one page down.
|
|
pageLeft()
Scrolls the matrix one page left.
|
|
Scrolls the matrix one page right.
|
|
pageUp()
Scrolls the matrix one page up.
|
|
<inner> |
scrollCols(direction, nCols)
Scrolls the matrix nCols columns in the given direction.
|
Scrolls the matrix one row down.
|
|
Scrolls the matrix one cell to the left.
|
|
Scrolls the matrix one cell to the right.
|
|
<inner> |
scrollRows(direction, nRows)
Scrolls the matrix nRows row in the given direction.
|
<inner> |
scrollTo(row, col)
Scroll to given position.
|
scrollUp()
Scrolls the matrix one row up.
|
|
snapToGrid(element, -)
Snap the element to grid.
|
|
<inner> |
Begin animating the matrix using _decelartionVelocity.
|
zoomIn()
Zooms one level in.
|
|
zoomOut()
Zooms one level out.
|
Class Detail
jMatrixBrowseNs.jMatrixBrowseRenderer(elem, configuration, api)
jMatrixBrowse Renderer manages the rendering of elements as well as row and
column headers.
- Parameters:
- {jQuery Object} elem
- - element that initiated jMatrixBrowse.
- {Object} configuration
- - configuration for jMatrixBrowse.
- {Object} api
- - api manager for making requests to api.
Method Detail
<inner>
cellClickHandler(elem, event)
Function that handles the click event on cell elements.
- Parameters:
- {jQuery Object} elem
- - Element that triggered the click event
- {Object} event
- - Click event.
<inner>
{Object}
checkPositionBounds(newPosition, changeInPosition, draggable)
Checks the bounds for the matirx from four directions to find if the bounds are violated and returns the new positions.
- Parameters:
- {Object} newPosition
- - The new position of the container for which to check the bounds.
- {Object} changeInPosition
- - The change in position. {top:0, left:0} can be passed here.
- {Object} draggable
- - The draggable instance.
- Returns:
- {Object} newPosition of the container.
<inner>
{boolean}
checkScrollBounds(direction)
Checks if the bounds for scrolling matrix are valid.
- Parameters:
- {string} direction
- direction of scroll
- Returns:
- {boolean} true if the bounds are valid. false otherwise.
<inner>
cleanup()
Removes all the DOM elements created by jMatrixBrowseRenderer.
<inner>
{jQuery Object}
createContentDiv(container)
Create the content div and append to container.
- Parameters:
- {jQuery Object} container
- - container to attacht the content to.
- Returns:
- {jQuery Object} content
<inner>
{Object, jQuery Object, jQuery Object}
createDragContainer(container)
Create the drag container and make it draggable.
- Parameters:
- {jQuery Object} container
- - container to attach the content to.
- Returns:
- {Object} coantiners
- {jQuery Object} coantiners.conatiner coantiner containing matrix content
- {jQuery Object} coantiners.dragConatiner dragCoantiner containing matrix content
<inner>
{Object, jQuery Object, jQuery Object}
createRowColumnHeaderContainer(container)
Create the row and column header containers.
- Parameters:
- {jQuery Object} container
- - container to attach the content to.
- Returns:
- {Object} headersContainer - hash containing column and row containers.
- {jQuery Object} headersContainer.row - row container.
- {jQuery Object} headersContainer.col - column container.
<inner>
dragHandler(event, ui)
Function that handles the drag event on dragContainer.
- Parameters:
- {Object} event
- - Drag event.
- {Object} ui
<inner>
dragStartHandler(event, ui)
Function that handles the drag start event on dragContainer.
- Parameters:
- {Object} event
- - Drag event.
- {Object} ui
<inner>
dragStopHandler(event, ui)
Function that handles the drag stop event on dragContainer.
- Parameters:
- {Object} event
- - Drag event.
- {Object} ui
<inner>
{string}
generateClassNameForCell(row, col)
Generate class name for given cell position.
- Parameters:
- {Number} row
- - zero indexed row of the element.
- {Number} col
- - zero indexed column of the element.
- Returns:
- {string} className - class name for the cell element.
<inner>
generateColHeaders(header)
Generates elements and appends them to column header container.
- Parameters:
- {jQuery object} header
- - column header container.
<inner>
{jQuery object}
generateInitialMatrixContent(container)
Creates an empty matrix with size obtained from API and appends to content.
- Parameters:
- {jQuery object} container
- - The element that acts as the matrix container (element that invoked jMatrixBrowse).
- Returns:
- {jQuery object} content where matrix is generated.
<inner>
{Object}
generatePositionsForDrag(draggable, event)
Generate new positions of the draggable element. This is used to override
the original generate positions which had no way of specifying dynamic
containment. This checks if the drag is valid by looking at the matrix
coordinates and returns the new top and left positions accordingly.
- Parameters:
- {Object} draggable
- - draggable object data.
- {Object} event
- - event that initiated the drag.
- Returns:
- {Object} positions - new position of the draggable.
<inner>
generateRowColumnHeaders(headers)
Creates an empty matrix with size obtained from API and appends to content.
- Parameters:
- {jQuery object} headers
- - header containers.
<inner>
generateRowHeaders(header)
Generates elements and appends them to row header container.
- Parameters:
- {jQuery object} header
- - row header container.
{Array of Array of DOM elements}
getCellElements()
Gets the cell elements.
- Returns:
- {Array of Array of DOM elements} Elements in the cell.
<inner>
{Object, Number, Number}
getCellPosition(row, col)
Get the cell position for cell at (row,col).
- Parameters:
- {Number} row
- - row index of the cell.
- {Number} col
- - column index of the cell.
- Returns:
- {Object} position - position of the cell.
- {Number} position.top - top coordinate of the cell.
- {Number} position.left - left coordinate of the cell.
<inner>
{jQuery Object}
getCellToSnap()
Finds the cell that is closest to the top left boundaries.
Checks only a few cells on the top.
- Returns:
- {jQuery Object} cell that is closest to the top left boundary.
{jQuery Object}
getContainer()
Gets the container for jMatrixBrowse.
- Returns:
- {jQuery Object} The container for jMatrixBrowse.
{Object, jQuery Object, jQuery Object}
getHeaders()
Gets the row and column headers.
- Returns:
- {Object} headers - row and column headers.
- {jQuery Object} headers.row - row header.
- {jQuery Object} headers.col - column header.
<inner>
{Number}
getNumberOfColsForPageScroll(direction)
Gets the number of cols that can be scrolled for a page left/right event without violating the matrix bounds.
- Parameters:
- {string} direction
- the direction of the scroll.
- Returns:
- {Number} the number of cols that can be safely scrolled.
<inner>
{Number}
getNumberOfRowsForPageScroll(direction)
Gets the number of rows that can be scrolled for a page up/down event without violating the matrix bounds.
- Parameters:
- {string} direction
- the direction of the scroll.
- Returns:
- {Number} the number of rows that can be safely scrolled.
<inner>
init(windowPosition)
Initializes the jMatrixBrowseRenderer component.
This creates the required contianers and generates content in the matrix.
- Parameters:
- {Object} windowPosition
- - position of first cell in window (properties: row and col)
{boolean}
moveColToLeft(col)
Moves a column to left.
- Parameters:
- {Number} col
- - index of the column to be moved.
- Returns:
- {boolean} true if the operation was successful. false otherwise.
{boolean}
moveColToRight(col)
Moves a column to right.
- Parameters:
- {Number} col
- - index of the column to be moved.
- Returns:
- {boolean} true if the operation was successful. false otherwise.
{boolean}
moveRowToEnd(row)
Moves the row to bottom.
- Parameters:
- {Number} row
- - index of the row to be moved.
- Returns:
- {boolean} true if the operation was successful. false otherwise.
{boolean}
moveRowToTop(row)
Moves the row to top.
- Parameters:
- {Number} row
- - index of the row to be moved.
- Returns:
- {boolean} true if the operation was successful. false otherwise.
pageDown()
Scrolls the matrix one page down.
pageLeft()
Scrolls the matrix one page left.
pageRight()
Scrolls the matrix one page right.
pageUp()
Scrolls the matrix one page up.
<inner>
scrollCols(direction, nCols)
Scrolls the matrix nCols columns in the given direction.
- Parameters:
- {string} direction
- - the direction to scroll.
- {Number} nCols
- - number of cols to scroll.
scrollDown()
Scrolls the matrix one row down.
scrollLeft()
Scrolls the matrix one cell to the left.
scrollRight()
Scrolls the matrix one cell to the right.
<inner>
scrollRows(direction, nRows)
Scrolls the matrix nRows row in the given direction.
- Parameters:
- {string} direction
- - the direction to scroll.
- {Number} nRows
- - number of rows to scroll.
<inner>
scrollTo(row, col)
Scroll to given position.
- Parameters:
- {Number} row
- - row index of the cell.
- {Number} col
- - column index of the cell.
scrollUp()
Scrolls the matrix one row up.
snapToGrid(element, -)
Snap the element to grid.
If called without any argument, it finds the element closest to the boundary (TODO) to snap.
If the direction is not defined, it snaps to both the top and left.
Otherwise, it snaps the given element in the given direction.
- Parameters:
- {jQuery Object} element
- - the element to snap to grid (optional).
- {string} -
- the direction to snap (from top, left) (optional).
<inner>
startAnimation()
Begin animating the matrix using _decelartionVelocity.
This uses cubic easing to ease out the animation. The duration of the animation can be set in configuration.
zoomIn()
Zooms one level in.
zoomOut()
Zooms one level out.