Class Papercube.PapersPerYearView
| Extends: | NodeGraph.DragPanMixin, SC.View |
| Defined in: | clients/papercube/views/papers_per_year.js |
| Version: | 1.0 |
| Author: | Peter Bergstrom |
| Copyright: | 2008-2009 Peter Bergström. |
Overview
Papercube.PapersPerYearView
This view shows the references or citations of a paper in chronological order, from it's publication year, into the past or the future. It uses nodes and edges to show the relationships. A paper only occurs once and there can be multiple edges going into a paper. This makes it almost the reverse of Circle View.
Constants defined in core.js:
var YEARLINE = 5; var YEARTEXT = 6; var PERYEAR_DEFAULT_SCALE = 20;
Property Summary
-
- (Integer) _cached_citeThreshold [R/W]Cite threshold cached value. -
- (Integer) _cached_depth [R/W]Depth cached value. -
- (Boolean) _cached_hideBogusYears [R/W]Hide bogus paper years cached value. -
- (Integer) _cached_refThreshold [R/W]Ref threshold cached value. -
- (Integer) _canvasHeight [R/W]Cached height of the view's canvas, set by the displayProperties. -
- (Integer) _canvasWidth [R/W]Cached width of the view's canvas, set by the displayProperties. -
- (Boolean) _displayRefs [R/W]Display references or citations. -
- (String) _foundGuid [R/W]The found GUID. -
- (Integer) _h [R/W]Cached height property from displayProperties. -
- (Integer) _metaDataBoxHeightSmall [R/W]Meta data box small height. -
- (Integer) _metaDataBoxWidthSmall [R/W]Meta data box small width. -
- (String) _selection [R/W]The current selection. -
- (Integer) _w [R/W]Cached width property from displayProperties. -
- (Integer) _x [R/W]Cached x-axis offset property from displayProperties. -
- (Integer) _y [R/W]Cached y-axis offset property from displayProperties. -
- (Integer) citeThresholdBinding [R/W]Bind the cite threshold binding. -
- (Integer) depthBinding [R/W]Bind the depth. -
- (Array) displayPropertiesBinding [R/W]Bind the display properties from the canvasController. -
- (String) edgeCiteColor [R/W]Cite edge color. -
- (String) edgeRefColor [R/W]Ref edge color. -
- (String) edgeWidth [R/W]Edge width. -
- (Boolean) hideBogusYearsBinding [R/W]Bind the hide bogus year param. -
- (Object) metaDataView [R/W]The DOM element that contains the meta data for an item. -
- (String) nodeBorderColor [R/W]Node border color. -
- (String) nodeBorderColorSel [R/W]Selected node border color. -
- (Integer) nodeBorderWidth [R/W]The default width of the node border. -
- (String) nodeColor [R/W]Node background color. -
- (String) nodeColorSel [R/W]Selected node background color. -
- (Float) nodeOpacity [R/W]Node opacity. -
- (Float) nodeOpacitySel [R/W]Selected node opacity. -
- (String) nodeTextColor [R/W]Node text color. -
- (Integer) nodeTextRatio [R/W]The nodeTextRatio allows the font size for the node to the calculated. -
- (Object) outlets [R/W]Outlets for author stat view. -
- (Integer) refThresholdBinding [R/W]Bind the ref threshold binding. -
- (DOM Element) svgCanvas [R/W]"canvas" for the svg tag. -
- (String) viewDirectionBinding [R/W]Bind the view direction from the viewController. -
- (String) yearLineColor [R/W]Year line color -
- (String) yearLineWidth [R/W]Year line width. -
- (String) yearTextColor [R/W]Year text color
Method Summary
-
- (void) _checkForData(guid, level)Check what data needs to be retrieved. -
- (void) _clearSVG()Clear all SVG elements. -
- (void) _clearSVGElms(has, array, svg)Clear SVG elements selectively. -
- (void) _createNode(guid, params, tParams, title)Create a new node element. -
- (Array) _createSVGElement(type, attributes, events, kind)Create a new SVG element. -
- (void) _createYearLine(guid, params)Create a new year line element. -
- (void) _createYearText(guid, params, text)Create a new year text element. -
- (void) _handleErrorParams(key, errParams)Create or update the error message when there are more than 300 papers in a year. -
- (void) _handleLinesTransition(guid, lineParams, yearTextLParams, yearTextRParams)Handle the lines and year text transition. -
- (void) _handleNodeTransition(guid, params, tParams)Handle the node transition. -
- (void) _hideMetaData()Hide meta data box. -
- (void) _removeEdges()Remove selected edges. -
- (void) _render()Collect what needs to be rendered. -
- (Boolean) _showMetaData(coordinates, guid)Show meta data for paper! -
- (void) _waitToCallServer(guids, callBack)Call the server to retrieve papers after waiting for a while. -
- (Boolean) displayPropertiesDidChange(force)When the displayProperities binding changes, update the view appropriately. -
- (void) init()Initalization function. -
- (void) mouseDown(evt)Save the GUID of the element and then show the fan. -
- (void) mouseExited(evt)If the mouse leaves the area, hide the meta-data view. -
- (void) mouseMoved(evt)If the mouse is moved on top of the view, see if there is any meta data to show. -
- (void) pinLinesForPaper()Pin the lines for paper. -
- (Boolean) redrawParamsDidChange()Redraw based on 'content', 'isVisible', 'viewDirection', 'refThreshold', 'depth', 'citeThreshold', 'hideBogusYears' binding changes.
Property Details
_cached_citeThreshold [R/W]
Cite threshold cached value.
- Integer _cached_citeThreshold
Default Value: 1
_cached_hideBogusYears [R/W]
Hide bogus paper years cached value.
- Boolean _cached_hideBogusYears
Default Value: false
_cached_refThreshold [R/W]
Ref threshold cached value.
- Integer _cached_refThreshold
Default Value: 0
_canvasHeight [R/W]
Cached height of the view's canvas, set by the displayProperties.
- Integer _canvasHeight
_canvasWidth [R/W]
Cached width of the view's canvas, set by the displayProperties.
- Integer _canvasWidth
Default Value: 800px
_metaDataBoxHeightSmall [R/W]
Meta data box small height.
- Integer _metaDataBoxHeightSmall
Default Value: 120
_metaDataBoxWidthSmall [R/W]
Meta data box small width.
- Integer _metaDataBoxWidthSmall
Default Value: 400
citeThresholdBinding [R/W]
Bind the cite threshold binding.
- Integer citeThresholdBinding
Bound To: "Papercube.papersPerYearController.citeThreshold"
Discussion
Don't show papers with less cites.
depthBinding [R/W]
Bind the depth.
- Integer depthBinding
Bound To: "Papercube.papersPerYearController.depth"
Discussion
Don't show items beyond this depth.
displayPropertiesBinding [R/W]
Bind the display properties from the canvasController.
- Array displayPropertiesBinding
Bound To: "Papercube.canvasController.displayProperties"
hideBogusYearsBinding [R/W]
Bind the hide bogus year param.
- Boolean hideBogusYearsBinding
Bound To: "Papercube.papersPerYearController.hideBogusYears"
Discussion
Don't show items that have bogus years.
metaDataView [R/W]
The DOM element that contains the meta data for an item.
- Object metaDataView
Discussion
Bound to the '.meta-data?' element.
nodeBorderColorSel [R/W]
Selected node border color.
- String nodeBorderColorSel
Default Value: '#FFB60B'
nodeBorderWidth [R/W]
The default width of the node border.
- Integer nodeBorderWidth
Default Value: 1px
nodeTextRatio [R/W]
The nodeTextRatio allows the font size for the node to the calculated.
- Integer nodeTextRatio
Default Value: 5
Discussion
The font size is calculated as radius/nodeTextRatio.
refThresholdBinding [R/W]
Bind the ref threshold binding.
- Integer refThresholdBinding
Bound To: "Papercube.papersPerYearController.refThreshold"
Discussion
Don't show papers with less refs.
viewDirectionBinding [R/W]
Bind the view direction from the viewController.
- String viewDirectionBinding
Bound To: "Papercube.viewController.viewDirection"
Method Detail
_checkForData()
Check what data needs to be retrieved.
- (void) _checkForData (guid, level)
Parameters
guid {string} The guid of the item.
level {Integer} The current level.
_clearSVGElms()
Clear SVG elements selectively.
- (void) _clearSVGElms (has, array, svg)
Parameters
has {Object} The old DOM node cache.
array {Array} The array of currently rendered DOM nodes.
(DOM Element)svg The DOM element to attach to.
_createNode()
Create a new node element.
- (void) _createNode (guid, params, tParams, title)
Parameters
guid {string} The cache key.
params {Object} Node positioning parameters.
tParams {Object} Text positioning parameters.
title {string} The title string.
_createSVGElement()
Create a new SVG element.
- (Array) _createSVGElement (type, attributes, events, kind)
Parameters
type {string} The node type.
attributes {Object} The attributes hash.
events {Object} The events hash.
kind {Integer} Flag that specifies what SVG element to attach the element to.
Returns
(Array) {DOM Element} The SVG element that was created.
_createYearLine()
Create a new year line element.
- (void) _createYearLine (guid, params)
Parameters
guid {string} The cache key.
params {Object} Year line positioning parameters.
_createYearText()
Create a new year text element.
- (void) _createYearText (guid, params, text)
Parameters
guid {string} The cache key.
params {Object} Year text positioning parameters.
_handleErrorParams()
Create or update the error message when there are more than 300 papers in a year.
- (void) _handleErrorParams (key, errParams)
Parameters
key {string} The cache key.
errParams {Object} Position parameters.
_handleLinesTransition()
Handle the lines and year text transition.
- (void) _handleLinesTransition (guid, lineParams, yearTextLParams, yearTextRParams)
Parameters
guid {string} The cache key.
lineParams {Object} Line positioning parameters.
yearTextLParams {Object} Left year text positioning parameters.
yearTextRParams {Object} Right year text positioning parameters.
_handleNodeTransition()
Handle the node transition.
- (void) _handleNodeTransition (guid, params, tParams)
Parameters
guid {string} The cache key.
params {Object} Node positioning parameters.
tParams {Object} Text positioning parameters.
_showMetaData()
Show meta data for paper!
- (Boolean) _showMetaData (coordinates, guid)
Parameters
coordinates {Object} The x,y coordinates of the mouse pointer.
guid {string} The guid of the item.
Returns
(Boolean) Returns NO if there are no coordinates or content.
_waitToCallServer()
Call the server to retrieve papers after waiting for a while.
- (void) _waitToCallServer (guids, callBack)
Parameters
guids {Array} The array of guids that need to be retrieved.
callBack {Function} The callBack function is called when the request is successful.
displayPropertiesDidChange()
When the displayProperities binding changes, update the view appropriately.
- (Boolean) displayPropertiesDidChange (force)
Parameters
force {boolean} If YES, force a redraw.
Returns
(Boolean) Returns NO if there is no guid of if the view is not visible.
Observes
displayProperties
init()
Initalization function.
- (void) init ()
Discussion
Set up the SVG DOM Nodes.
Set up the fan menu actions:
focusedFan: { CiteSeer: citeseerFunc, Save: saveFunc, "Pin Lines": pinLinesFunc, "Zoom +": zoomInFunc, "Zoom -": zoomOutFunc }, unfocusedFan: { CiteSeer: citeseerFunc, Save: saveFunc, "Pin Lines": pinLinesFunc, Refocus: refocusFunc, "Zoom +": zoomInFunc, "Zoom -": zoomOutFunc }
mouseDown()
Save the GUID of the element and then show the fan.
- (void) mouseDown (evt)
Parameters
(DOM Event)evt The mouseDown event.
mouseExited()
If the mouse leaves the area, hide the meta-data view.
- (void) mouseExited (evt)
Parameters
(DOM Event)evt The mouseExited event.
mouseMoved()
If the mouse is moved on top of the view, see if there is any meta data to show.
- (void) mouseMoved (evt)
Parameters
(DOM Event)evt The mouseMoved event.
redrawParamsDidChange()
Redraw based on 'content', 'isVisible', 'viewDirection', 'refThreshold', 'depth', 'citeThreshold', 'hideBogusYears' binding changes.
- (Boolean) redrawParamsDidChange ()
Returns
(Boolean) Returns NO if there is no guid of if the view is not visible.
Observes
content
isVisible
viewDirection
refThreshold
citeThreshold
depth
hideBogusYears