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
Timegrid.LayoutFactory()
Constructs a LayoutFactory object.
Timegrid.Layout(eventSource, params)
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
Timegrid.LayoutFactory.registerLayout(name, constructor)
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
Timegrid.LayoutFactory.createLayout(name, eventSource, params)
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
Timegrid.Layout.timezoneMapper(date)
A function to map date objects to a custom timezone
parameters
date
Timegrid.Layout.xMapper(obj)
A function to map endpoints to an integer x-coordinate
parameters
obj
Timegrid.Layout.yMapper(obj)
A function to map endpoints to an integer y-coordinate
parameters
obj
Timegrid.Layout.configure(params)
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.
Timegrid.Layout.render(container)
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
Timegrid.Layout.renderEvents(doc)
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
Object Timegrid.Layout.params
An object containing a parameter hash
Number Timegrid.Layout.xSize
The number of columns in the grid
Number Timegrid.Layout.ySize
The number of rows in the grid
Number Timegrid.Layout.xLabelHeight
The height of the horizontal labels in pixels
Number Timegrid.Layout.yLabelWidth
The width of the vertical labels in pixels
Timegrid.Layout.tabHeight
The height of the tabs that page between views
Generated by JsDoc Toolkit on Mon, 20 Aug 2007 18:41:57 GMT