toCode implemented
This commit is contained in:
1 parent
33076a3f32
commit
2eb284c8c7
2 files changed
+54
-1
No files matched your search
@@ -54,6 +54,7 @@ function newConditionEditor () {
|
||||
}
|
||||
|
||||
function deactivate () {
|
||||
convertToCode()
|
||||
finalizePickers()
|
||||
|
||||
if (thisObject.visible === true) {
|
||||
@@ -62,6 +63,50 @@ function newConditionEditor () {
|
||||
EDITOR_ON_FOCUS = false
|
||||
}
|
||||
|
||||
function convertToCode () {
|
||||
if (operatorA === undefined || operatorB === undefined || operationPicker === undefined) { return }
|
||||
|
||||
// chart.at01hs.bollingerSubChannel.previous.previous.slope=== "Extreme"
|
||||
let code = ''
|
||||
|
||||
code = code + 'chart.at' + operatorA.timeFramePicker.getValue().replace('-', '')
|
||||
code = code + '.' + operatorA.productPicker.getValue()
|
||||
code = code + '.' + operatorA.propertyPicker.getValue()
|
||||
|
||||
switch (operationPicker.getValue()) {
|
||||
case 'Greater Than': {
|
||||
code = code + ' > '
|
||||
break
|
||||
}
|
||||
case 'Less Than': {
|
||||
code = code + ' < '
|
||||
break
|
||||
}
|
||||
case 'Greater or Equal Than': {
|
||||
code = code + ' >= '
|
||||
break
|
||||
}
|
||||
case 'Less or Equal Than': {
|
||||
code = code + ' <= '
|
||||
break
|
||||
}
|
||||
case 'Equal To': {
|
||||
code = code + ' === '
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (operationPicker.getValue() === 'Equal To') {
|
||||
code = code + '"' + operatorA.valuePicker.getValue() + '"'
|
||||
} else {
|
||||
code = code + 'chart.at' + operatorB.timeFramePicker.getValue().replace('-', '')
|
||||
code = code + '.' + operatorB.productPicker.getValue()
|
||||
code = code + '.' + operatorB.propertyPicker.getValue()
|
||||
}
|
||||
|
||||
thisObject.payload.node.code = code
|
||||
}
|
||||
|
||||
function activate (payload) {
|
||||
thisObject.visible = true
|
||||
thisObject.payload = payload
|
||||
@@ -245,15 +290,18 @@ function newConditionEditor () {
|
||||
finalizeOperator(operatorA)
|
||||
finalizeOperator(operatorB)
|
||||
|
||||
operationPicker.container.eventHandler.stopListening(operationPicker.eventSuscriptionId)
|
||||
operatorA = undefined
|
||||
operatorB = undefined
|
||||
|
||||
if (operationPicker !== undefined) {
|
||||
operationPicker.container.eventHandler.stopListening(operationPicker.eventSuscriptionId)
|
||||
operationPicker.finalize()
|
||||
operationPicker = undefined
|
||||
}
|
||||
}
|
||||
|
||||
function finalizeOperator (operator) {
|
||||
if (operator === undefined) { return }
|
||||
if (operator.dataMinePicker !== undefined) {
|
||||
operator.dataMinePicker.container.eventHandler.stopListening(operator.botPicker.eventSuscriptionId)
|
||||
operator.dataMinePicker.finalize()
|
||||
|
||||
@@ -5,6 +5,7 @@ function newPicker () {
|
||||
let thisObject = {
|
||||
container: undefined,
|
||||
selectedItem: 0,
|
||||
getValue: getValue,
|
||||
onParentChanged: onParentChanged,
|
||||
getSelected: getSelected,
|
||||
physics: physics,
|
||||
@@ -54,6 +55,10 @@ function newPicker () {
|
||||
onMouseWheelEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseWheel', onMouseWheel)
|
||||
}
|
||||
|
||||
function getValue () {
|
||||
return optionsList[selected]
|
||||
}
|
||||
|
||||
function onParentChanged (event) {
|
||||
if (event.parent !== undefined) {
|
||||
parent = event.parent
|
||||
|
||||
Reference in new issue
Block a user