Library: layout.js
Overview
This is where we define the entrypoint for all of the different default
layouts that Timegrid is capable of, e.g. month, week, n-day, etc. Both
LayoutFactory and the common Layout superclass are defined in this file.
- author: masont
Constructors
Instantiates a Layout object. This constructor should always be overridden.
parameters
| EventSource | eventSource | the eventSource to pull events from |
| Object | params | a parameter hash |
methods
properties
Functions
Registers a layout class with this layout factory. Automatically places the
given layout under the common Layout superclass, and binds the name string
to the constructor.
parameters
| String | name | the name to bind to the given constructor |
| Function | constructor | the constructor to a layout class |
Instantiates a Timegrid layout with the given parameter hash.
parameters
| String | name | the name of the layout |
| EventSource | eventSource | an EventSource object to layout and render |
| params | a hash of parameters to be passed into the desired layout |
returns
| Timegrid.Layout | a Timegrid.Layout instance of the specified subclass |
A function to map date objects to a custom timezone
parameters
| date |
Takes a parameter hash and extends this layout with it, flattening key names
to lowercase as it goes. This is done to eliminate browser-specific
attribute case sensitivity.
parameters
| Object | params | a parameter hash |
Timegrid.Layout.computeCellSizes()
Computes the grid dimensions (gridheight, gridwidth, ycell, xcell) for this
layout. This is relatively complex since any of the above values can be
either user-specified or computed.
Renders out this layout into a DOM object with a wrapping div element as its
parent, returning the div.
parameters
| Element | container | the parent element |
returns
| Element | a rendered DOM tree descended from a div element |
An abstract method to render events for this layout. This method is where
specific layout implementations hook into the main rendering loop. While
generally used to render events, this method can return any valid input to
the jQuery
append method, which is then appended under the grid
div element.parameters
| Document | doc | the document to create elements from |
returns
| Content |
any valid argument to jQuery's append, to be appended under
the grid div
|
Timegrid.Layout.renderGridlines()
Renders the gridlines for this layout. Gridlines are represented in the DOM
as absolutely positioned
div elements with one dimension set to
one pixel.returns
| Element | a DOM element containing this layout's gridlines |
Timegrid.Layout.renderXLabels()
Renders the horizontal column labels that run above the grid. The labels
themselves are provided by the implementing layout subclasses by
getXLabels()returns
| Element | a DOM element containing the horizontal labels |
Timegrid.Layout.renderYLabels()
Renders the vertical row labels that run along the side of the grid. The
labels themselves are provided by the implementing layout subclasses by
getYLabels()returns
| Element | a DOM element containing the vertical labels |
Timegrid.Layout.getXLabels()
An abstract method to get the horizontal column labels for this layout. This
method must be implemented by all layout types subclassing Layout.
returns
| Array | an array of strings to use as column labels |
Timegrid.Layout.getYLabels()
An abstract method to get the vertical row labels for this layout. This
method must be implemented by all layout types subclassing Layout.
returns
| Array | an array of strings to use as row labels |
Objects
An object containing a parameter hash
The number of columns in the grid
The number of rows in the grid
The height of the horizontal labels in pixels
The width of the vertical labels in pixels
Timegrid.Layout.tabHeight
The height of the tabs that page between views