2015-07-03 05:49:45 +00:00
|
|
|
|
2016-09-26 09:28:47 +00:00
|
|
|
module.exports = new Class
|
2015-07-03 05:49:45 +00:00
|
|
|
({
|
|
|
|
Extends: Vn.Object
|
|
|
|
,Tag: 'htk-assistant'
|
|
|
|
,Properties:
|
|
|
|
{
|
|
|
|
stepCount:
|
|
|
|
{
|
|
|
|
type: Number
|
|
|
|
,set: function (x)
|
|
|
|
{
|
|
|
|
this._stepCount = x;
|
|
|
|
|
|
|
|
if (x > 0)
|
|
|
|
this.setStep (0);
|
|
|
|
else
|
|
|
|
this.setStep (-1);
|
|
|
|
}
|
|
|
|
,get: function ()
|
|
|
|
{
|
|
|
|
return this._stepCount;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
step:
|
|
|
|
{
|
|
|
|
type: Number
|
|
|
|
,set: function (x)
|
|
|
|
{
|
|
|
|
this.setStep (x);
|
|
|
|
}
|
|
|
|
,get: function ()
|
|
|
|
{
|
|
|
|
return this._stepIndex;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
stepFunc:
|
|
|
|
{
|
|
|
|
type: Function
|
|
|
|
,set: function (x)
|
|
|
|
{
|
|
|
|
this._stepFunc = x;
|
|
|
|
this.setStep (this._stepIndex);
|
|
|
|
}
|
|
|
|
,get: function ()
|
|
|
|
{
|
|
|
|
return this._stepFunc;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
node:
|
|
|
|
{
|
|
|
|
type: Object
|
|
|
|
,set: function (x)
|
|
|
|
{
|
|
|
|
x.className = 'htk-assistant';
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
,_stepNode: null
|
|
|
|
,_stepIndex: -1
|
|
|
|
,_stepCount: 0
|
|
|
|
,_stepFunc: null
|
|
|
|
|
|
|
|
,setStep: function (stepIndex)
|
|
|
|
{
|
|
|
|
if (!(stepIndex >= -1 && stepIndex < this.stepCount))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (this._stepFunc && stepIndex != -1)
|
|
|
|
{
|
|
|
|
var stepNode = this._stepFunc (stepIndex);
|
|
|
|
|
|
|
|
if (stepNode)
|
|
|
|
{
|
|
|
|
if (this._stepNode)
|
|
|
|
this._stepNode.style.display = 'none';
|
|
|
|
|
|
|
|
this._stepNode = stepNode;
|
|
|
|
stepNode.style.display = 'block';
|
|
|
|
|
|
|
|
this._setStepIndex (stepIndex);
|
|
|
|
}
|
|
|
|
else if (this._stepIndex < stepIndex)
|
|
|
|
this.setStep (stepIndex + 1);
|
|
|
|
else
|
|
|
|
this.setStep (stepIndex - 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
this._setStepIndex (stepIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
,_setStepIndex: function (stepIndex)
|
|
|
|
{
|
|
|
|
this._stepIndex = stepIndex;
|
2017-04-19 06:16:37 +00:00
|
|
|
this.emit ('step-change', stepIndex);
|
2015-07-03 05:49:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
,movePrevious: function ()
|
|
|
|
{
|
|
|
|
this.setStep (this._stepIndex - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
,moveNext: function ()
|
|
|
|
{
|
|
|
|
this.setStep (this._stepIndex + 1);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|