Last active
April 13, 2017 02:47
-
-
Save swcho/9532a70f67e09fb694303848c24d5dc3 to your computer and use it in GitHub Desktop.
Class Inheritance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function CControl() { | |
}; | |
CControl.prototype = new CObject(); | |
CControl.prototype.init = function (elementId, focusableClassName, focusedClassName, focusChangedEventHandler) { | |
//DBG('CControl.init [' + this.getName() + ']'); | |
var a = this; | |
a._app = gApp; | |
a._shown = false; | |
a._isGlobal = false; | |
a._hideTimer = null; | |
a._children = []; | |
a._id = elementId ? elementId : ''; | |
a._focusableClassName = focusableClassName; | |
a._focusedClassName = focusedClassName; | |
if (focusableClassName && focusedClassName) { | |
//DBG('CControl: has naviMap'); | |
if (focusChangedEventHandler) { | |
a._naviMap = new CKeyNaviMap(this, focusableClassName, focusedClassName, focusChangedEventHandler); | |
} else { | |
a._naviMap = new CKeyNaviMap(this, focusableClassName, focusedClassName, function($old, $new) { | |
a.handleFocusChanged($old, $new); | |
}); | |
} | |
} | |
else { | |
a._naviMap = null; | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var CListControl = function($self, rowCount) { | |
if (arguments.length) { | |
this.init($self, rowCount); | |
} | |
}; | |
CListControl.prototype = new CControl(); | |
CListControl.prototype.init = function ($self, rowCount) { | |
var a = this; | |
CControl.prototype.init.call(a, '#' + $self.attr('id'), 'focusable', 'focused'); | |
a.name = 'CListControl.{' + $self.attr('id') + '}'; | |
var $list = $('<div>', { 'class': '-list' }); | |
var $noItemMsg = $('<span style="position:absolute; top:10px; width:762px">').text('No item'); | |
$list.append($noItemMsg); | |
$noItemMsg.hide(); | |
var i; | |
for ( i = 0; i < rowCount; i += 1 ) { | |
var $listItem = $('<div>', { 'class': '-list-item' }).attr('data', i); | |
$list.append($listItem); | |
} | |
var $pagenationPrompt = $('<div>', { 'class': '-list-pagenation-prompt' }); | |
var $pageUp = $('<div>', { 'class': '-pagenation-page-up' }); | |
var $pageDown = $('<div>', { 'class': '-pagenation-page-down' }); | |
$pageUp.append($('<img>', { src: "image/button/btn_bottom_key_pgup.png" })); | |
$pageUp.append($('<span>').text('Page Up')); | |
$pageDown.append($('<img>', { src: "image/button/btn_bottom_key_pgdn.png" })); | |
$pageDown.append($('<span>').css('margin-right', '42px').text('Page down')); | |
$pagenationPrompt.append($pageUp); | |
$pagenationPrompt.append($pageDown); | |
var $helpPrompt = $('<div>', { 'class': '-list-pagenation-prompt' }); | |
var $indexingText = $('<p>').css({ 'float': 'right' }); | |
$pagenationPrompt.append($indexingText); | |
$pagenationPrompt.hide(); | |
$list.append($pagenationPrompt); | |
$list.append($helpPrompt); | |
$self.append($list); | |
a._$self = $self; | |
a._$list = $list; | |
a._$listItems = a._$list.children('.-list-item'); | |
a._$noItemMsg = $noItemMsg; | |
a._$helpPrompt = $helpPrompt; | |
a._$paginationPrompt = $pagenationPrompt; | |
a._$pageUp = $pageUp; | |
a._$pageDown = $pageDown; | |
a._$indexingText = $indexingText; | |
a._model = null; | |
a._rowCount = rowCount; | |
a.onFocusGained = null; | |
a.onFocusLost = null; | |
a.onListItemSelected = null; | |
a.onListItemFocusChanged = null; | |
a._dataRolling = true; | |
a._showPagination = true; | |
a._showHelpString = true; | |
a._showEmpty = false; | |
a._animation = true; | |
a._animating = false; | |
a._upDownUnit = a._rowCount - 1; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment