highlights and values working
This commit is contained in:
1 parent
1ed6a48488
commit
6796745980
10 files changed
+233
-140
No files matched your search
+18
-9
@@ -8,29 +8,38 @@ function newNodesErrors () {
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
let rootNode
|
||||
let hiriarchyMap
|
||||
return thisObject
|
||||
|
||||
function finalize () {
|
||||
rootNode = undefined
|
||||
hiriarchyMap = undefined
|
||||
}
|
||||
|
||||
function initialize (pRootNode) {
|
||||
rootNode = pRootNode
|
||||
let rootNode = canvas.designSpace.workspace.getHierarchyHeadsById(pRootNode.id)
|
||||
hiriarchyMap = getHiriarchyMap(rootNode)
|
||||
}
|
||||
|
||||
function onRecordChange (currentRecord) {
|
||||
evalNode(rootNode, currentRecord.array, 0, applyError)
|
||||
if (currentRecord === undefined) { return }
|
||||
let array = currentRecord.errors
|
||||
if (array === undefined) { return }
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
let arrayItem = array[0]
|
||||
let nodeId = arrayItem[0]
|
||||
let value = arrayItem[1]
|
||||
applyValue(nodeId, value)
|
||||
}
|
||||
}
|
||||
|
||||
function applyError (node, errorMessage) {
|
||||
function applyValue (nodeId, value) {
|
||||
let node = hiriarchyMap.get(nodeId)
|
||||
if (node.payload === undefined) { return }
|
||||
if (node.payload.uiObject === undefined) { return }
|
||||
if (errorMessage === '') {
|
||||
node.payload.uiObject.resetErrorMessage(errorMessage)
|
||||
if (value === '') {
|
||||
node.payload.uiObject.resetErrorMessage()
|
||||
} else {
|
||||
node.payload.uiObject.setErrorMessage(errorMessage)
|
||||
node.payload.uiObject.setErrorMessage(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,23 +9,32 @@ function newNodesHighlights () {
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
let rootNode
|
||||
let hiriarchyMap
|
||||
return thisObject
|
||||
|
||||
function finalize () {
|
||||
rootNode = undefined
|
||||
hiriarchyMap = undefined
|
||||
}
|
||||
|
||||
function initialize (pRootNode) {
|
||||
rootNode = pRootNode
|
||||
let rootNode = canvas.designSpace.workspace.getHierarchyHeadsById(pRootNode.id)
|
||||
hiriarchyMap = getHiriarchyMap(rootNode)
|
||||
}
|
||||
|
||||
function onRecordChange (currentRecord) {
|
||||
evalNode(rootNode, currentRecord.array, 0, applyHighlight)
|
||||
if (currentRecord === undefined) { return }
|
||||
let array = currentRecord.highlights
|
||||
if (array === undefined) { return }
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
let arrayItem = array[0]
|
||||
let nodeId = arrayItem[0]
|
||||
let value = arrayItem[1]
|
||||
applyValue(nodeId, value)
|
||||
}
|
||||
}
|
||||
|
||||
function applyHighlight (node, value) {
|
||||
if (value !== 1) { return }
|
||||
function applyValue (nodeId, value) {
|
||||
let node = hiriarchyMap.get(nodeId)
|
||||
if (node.payload === undefined) { return }
|
||||
if (node.payload.uiObject === undefined) { return }
|
||||
node.payload.uiObject.highlight()
|
||||
|
||||
+19
-6
@@ -9,24 +9,37 @@ function newNodesValues () {
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
let rootNode
|
||||
let hiriarchyMap
|
||||
return thisObject
|
||||
|
||||
function finalize () {
|
||||
rootNode = undefined
|
||||
hiriarchyMap = undefined
|
||||
}
|
||||
|
||||
function initialize (pRootNode) {
|
||||
rootNode = pRootNode
|
||||
let rootNode = canvas.designSpace.workspace.getHierarchyHeadsById(pRootNode.id)
|
||||
hiriarchyMap = getHiriarchyMap(rootNode)
|
||||
}
|
||||
|
||||
function onRecordChange (currentRecord) {
|
||||
evalNode(rootNode, currentRecord.array, 0, applyValue)
|
||||
if (currentRecord === undefined) { return }
|
||||
let array = currentRecord.values
|
||||
if (array === undefined) { return }
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
let arrayItem = array[0]
|
||||
let nodeId = arrayItem[0]
|
||||
let value = arrayItem[1]
|
||||
applyValue(nodeId, value)
|
||||
}
|
||||
}
|
||||
|
||||
function applyValue (node, value) {
|
||||
function applyValue (nodeId, value) {
|
||||
let node = hiriarchyMap.get(nodeId)
|
||||
if (node.payload === undefined) { return }
|
||||
if (node.payload.uiObject === undefined) { return }
|
||||
node.payload.uiObject.setValue(value)
|
||||
if (value === true) { value = 'true' }
|
||||
if (value === false) { value = 'false' }
|
||||
node.payload.uiObject.setValue(value, 30)
|
||||
}
|
||||
}
|
||||
|
||||
+5
-14
@@ -245,9 +245,7 @@ function newPlotter () {
|
||||
function draw () {
|
||||
try {
|
||||
thisObject.container.frame.draw()
|
||||
if (productDefinition.referenceParent.shapes !== undefined) {
|
||||
plotShapes()
|
||||
}
|
||||
plot()
|
||||
} catch (err) {
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] draw -> err = ' + err.stack) }
|
||||
}
|
||||
@@ -491,13 +489,10 @@ function newPlotter () {
|
||||
}
|
||||
}
|
||||
|
||||
function plotShapes () {
|
||||
function plot () {
|
||||
try {
|
||||
/* Clean the pannel at places where there is no record. */
|
||||
let currentRecord = {
|
||||
data: undefined
|
||||
}
|
||||
thisObject.container.eventHandler.raiseEvent('Current Record Changed', currentRecord)
|
||||
thisObject.container.eventHandler.raiseEvent('Current Record Changed', undefined)
|
||||
|
||||
for (let i = 0; i < records.length; i++) {
|
||||
let record = records[i]
|
||||
@@ -541,11 +536,7 @@ function newPlotter () {
|
||||
let atMousePosition = false
|
||||
if (userPositionDate >= record.begin && userPositionDate <= record.end) {
|
||||
atMousePosition = true
|
||||
|
||||
let currentRecord = {
|
||||
data: record
|
||||
}
|
||||
thisObject.container.eventHandler.raiseEvent('Current Record Changed', currentRecord)
|
||||
thisObject.container.eventHandler.raiseEvent('Current Record Changed', record)
|
||||
}
|
||||
|
||||
/* If there is code we execute it now. */
|
||||
@@ -794,7 +785,7 @@ function newPlotter () {
|
||||
|
||||
logged = false
|
||||
} catch (err) {
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] plotShapes -> err = ' + err.stack) }
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] plot -> err = ' + err.stack) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user