Namespace Papercube.viewController
| Extends: | SC.Object |
| Defined in: | clients/papercube/controllers/view.js |
| Version: | 1.0 |
| Author: | Peter Bergstrom |
| Copyright: | 2008-2009 Peter Bergström. |
Overview
This controller controls what view is currently being shown. There are two dimensions, the type of object being visualized (ie. Authors or Papers) and the type of view that we're showing (ie. CircleView or TreeView).
Property Summary
-
+ (Array) _history [R/W]History array. -
+ (Integer) _historyIdx [R/W]The current index into the history array. -
+ (Array) _saved [R/W]Saved papers or authors. -
+ (Object) _savedGuids [R/W]The guids of the items saved. -
+ (Object) _timer [R/W]The timer for the back button. -
+ (Object) _viewVisibilities [R/W]Visibilty relation hash. -
+ (Author) authorForView [R/W]This is the content that you set that your views listen to. -
+ (Boolean) authorPaperViewShowing [R/W]authorPaperView's visibility. -
+ (Boolean) authorStatViewShowing [R/W]authorStatView's visibility. -
+ (String) authorViewChoice [R/W]Default authorViewChoice is 'Author Detail'. -
+ (Boolean) circleViewShowing [R/W]circleView's visibility. -
+ (Boolean) citeRefViewShowing [R/W]citeRefView's visibility. -
+ (Boolean) collaboratorViewShowing [R/W]collaboratorView's visibility. -
+ (Record) contentForView [R/W]This is the type agnostic param that is used for saving. -
+ (Boolean) noContentForView [R/W]This is the type agnostic param that is used for saving. -
+ (String) nowShowing [R/W]Now showing property for the tab view. -
+ (Paper) paperForView [R/W]This is the content that you set that your views listen to. -
+ (Boolean) paperGraphViewShowing [R/W]paperGraphView's visibility. -
+ (Boolean) papersPerYearViewShowing [R/W]papersPerYearView's visibility. -
+ (Boolean) paperStatViewShowing [R/W]paperStatView's visibility. -
+ (Boolean) paperTreeViewShowing [R/W]paperTreeView's visibility. -
+ (String) paperViewChoice [R/W]Default paperViewChoice is 'Paper Detail'. -
+ (Array) savedContent [R/W]The content array for the savedPanelView. -
+ (Boolean) savedPanelViewShowing [R/W]savedPanelView's visibility. -
+ (Boolean) shouldNotShowAgain [R/W]Checkbox value. -
+ (Boolean) showIntroView [R/W]The intro view visibility. -
+ (String) viewChoice [R/W]Default viewChoice is 'Paper Detail'. -
+ (Object) viewChoices [R/W]Available views for viewing modes. -
+ (String) viewDirection [R/W]Default view direction. -
+ (Array) viewDirectionChoices [R/W]Available view directions. -
+ (String) viewingMode [R/W]Default viewing mode is Papers. -
+ (Array) viewingModes [R/W]Available viewing modes.
Method Summary
-
+ (void) _setHistoryLocation()Set the location. -
+ (void) _showHistoryItem(idx)Show an item in the history based on the index passed in. -
+ (void) addToHistory(guid, type, label)Add to the history. -
+ (void) checkLocation()Check for location change and then chang it. -
+ (void) clearSaved()Clear the saved items array and cookie. -
+ (Array) collectNeededPaperGUIDs(rel, guids)Collect the guids needed to be retrieved for a given view. -
+ (void) hideSaved()Hide the savedPanelView. -
+ (void) hideVideo()Hide the video and write the cookie if needed. -
+ (void) noContentForViewDidChange()If the contentForView is not null, set noContentForView to YES. -
+ (Boolean) readSavedItemsCookie()Read the saved items from the 'papercube' cookie. -
+ (void) saveObject(guid, type)Given the guid and contnet type of an item, save it. -
+ (void) setContentToView(content, fromHistory)Set the content for the view. -
+ (void) setContentToViewFromGUID(guid, type, fromHistory)Set the content for the view form a guid. -
+ (Boolean) setViewChoice(viewChoice, fromHistory)Change views. -
+ (void) setViewDirection(direction, fromHistory)Change viewing direction. -
+ (Boolean) setViewingMode(viewMode, fromHistory)Set the viewing mode. -
+ (void) showDefaultView()Load default view. -
+ (void) showSaved()Show the savedPanelView. -
+ (void) showVideo()Show the video if the cookie is not written. -
+ (void) viewAuthor(guid)View an author. -
+ (void) viewPaper(guid)View an paper.
Property Details
_history [R/W]
History array.
+ Array _history
Discussion
Each item is saved in the following format:
{ guid: guid, type: type, label: label, viewChoice: this.get('viewChoice'), viewDirection: this.get('viewDirection'), viewingMode: this.get('viewingMode') }
_saved [R/W]
Saved papers or authors.
+ Array _saved
Discussion
Saved documents are only per session at the moment.
Saved in the format:
{type: "Paper", guid: 'PAPER-1233'} {type: "Author", guid: 'AUTHOR-1233'}
_savedGuids [R/W]
The guids of the items saved.
+ Object _savedGuids
Discussion
This is kept around so that things aren't saved more than once.
authorForView [R/W]
This is the content that you set that your views listen to.
+ Author authorForView
authorPaperViewShowing [R/W]
authorPaperView's visibility.
+ Boolean authorPaperViewShowing
Default Value: NO
Discussion
Author view.
authorStatViewShowing [R/W]
authorStatView's visibility.
+ Boolean authorStatViewShowing
Default Value: NO
Discussion
Author view.
authorViewChoice [R/W]
Default authorViewChoice is 'Author Detail'.
+ String authorViewChoice
Default Value: 'Author Detail'
circleViewShowing [R/W]
circleView's visibility.
+ Boolean circleViewShowing
Default Value: NO
Discussion
Paper view.
citeRefViewShowing [R/W]
citeRefView's visibility.
+ Boolean citeRefViewShowing
Default Value: NO
Discussion
Author view.
collaboratorViewShowing [R/W]
collaboratorView's visibility.
+ Boolean collaboratorViewShowing
Default Value: NO
Discussion
Author view.
contentForView [R/W]
This is the type agnostic param that is used for saving.
+ Record contentForView
noContentForView [R/W]
This is the type agnostic param that is used for saving.
+ Boolean noContentForView
Discussion
True if there is no content set yet. If YES, the empty view is shown.
nowShowing [R/W]
Now showing property for the tab view.
+ String nowShowing
Default Value: 'noContent'
paperGraphViewShowing [R/W]
paperGraphView's visibility.
+ Boolean paperGraphViewShowing
Default Value: NO
Discussion
Paper view.
papersPerYearViewShowing [R/W]
papersPerYearView's visibility.
+ Boolean papersPerYearViewShowing
Default Value: NO
Discussion
Paper view.
paperStatViewShowing [R/W]
paperStatView's visibility.
+ Boolean paperStatViewShowing
Default Value: NO
Discussion
Paper view.
paperTreeViewShowing [R/W]
paperTreeView's visibility.
+ Boolean paperTreeViewShowing
Default Value: NO
Discussion
Paper view.
paperViewChoice [R/W]
Default paperViewChoice is 'Paper Detail'.
+ String paperViewChoice
Default Value: 'Paper Detail'
savedPanelViewShowing [R/W]
savedPanelView's visibility.
+ Boolean savedPanelViewShowing
Default Value: NO
shouldNotShowAgain [R/W]
Checkbox value.
+ Boolean shouldNotShowAgain
Default Value: YES
Discussion
Default YES so that it never is shown again.
viewChoice [R/W]
Default viewChoice is 'Paper Detail'.
+ String viewChoice
Default Value: 'Paper Detail'
Method Detail
_showHistoryItem()
Show an item in the history based on the index passed in.
+ (void) _showHistoryItem (idx)
Parameters
idx {Integer} The index to go to.
Discussion
Read in the history item and set back all the parameters saved.
addToHistory()
Add to the history.
+ (void) addToHistory (guid, type, label)
Parameters
guid {Integer} The item's guid.
type {string} The item's content type.
label {string} The label of the item.
collectNeededPaperGUIDs()
Collect the guids needed to be retrieved for a given view.
+ (Array) collectNeededPaperGUIDs (rel, guids)
Parameters
rel {string} The paper guid relation array.
guids {Array} Array of needed guids.
Returns
(Array) {object} Returns a hash containing papers that exist and guids that need to be retrieved.
noContentForViewDidChange()
If the contentForView is not null, set noContentForView to YES.
+ (void) noContentForViewDidChange ()
Observes
contentForView
readSavedItemsCookie()
Read the saved items from the 'papercube' cookie.
+ (Boolean) readSavedItemsCookie ()
Returns
(Boolean) Returns NO if there is an error.
Discussion
Save the items to the _saved and _savedGuids arrays.
saveObject()
Given the guid and contnet type of an item, save it.
+ (void) saveObject (guid, type)
Parameters
guid {Integer} The item's guid.
type {string} The item's content type.
setContentToView()
Set the content for the view.
+ (void) setContentToView (content, fromHistory)
Parameters
content {Record} The content object. Either an Author or Paper.
fromHistory {boolean} True if the view direction is set from a history action.
setContentToViewFromGUID()
Set the content for the view form a guid.
+ (void) setContentToViewFromGUID (guid, type, fromHistory)
Parameters
guid {string} The guid of the content that you want to pass to setContentToView.
type {string} The type of the content. Either 'Author' or 'Paper'.
fromHistory {boolean} True if the view direction is set from a history action.
setViewChoice()
Change views.
+ (Boolean) setViewChoice (viewChoice, fromHistory)
Parameters
viewChoice {string} the view choice.
fromHistory {boolean} True if the view direction is set from a history action.
Returns
(Boolean) Returns NO if there is a error.
setViewDirection()
Change viewing direction.
+ (void) setViewDirection (direction, fromHistory)
Parameters
direction {string} the view direction.
fromHistory {boolean} True if the view direction is set from a history action.
setViewingMode()
Set the viewing mode.
+ (Boolean) setViewingMode (viewMode, fromHistory)
Parameters
viewMode {string} the view mode.
fromHistory {boolean} True if the view direction is set from a history action.
Returns
(Boolean) Returns NO if there is a error.
showSaved()
Show the savedPanelView.
+ (void) showSaved ()
Discussion
Look at the saved item guids and find the content from the store.
viewAuthor()
View an author.
+ (void) viewAuthor (guid)
Parameters
guid {string} The guid of the content that you want to pass to setContentToView.
viewPaper()
View an paper.
+ (void) viewPaper (guid)
Parameters
guid {string} The guid of the content that you want to pass to setContentToView.