• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mobalazs / rotor-framework / 18919729013

29 Oct 2025 07:21PM UTC coverage: 85.379% (-0.1%) from 85.479%
18919729013

push

github

mobalazs
fix: update debug setting in bsconfig to enable debugging

1781 of 2086 relevant lines covered (85.38%)

1.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.05
/src/source/engine/builder/Processor.bs
1
namespace Rotor.ViewBuilder
2

3
    ' =====================================================================
4
    ' Processor - Core processor that orchestrates widget lifecycle operations. Routes widget configurations to appropriate handlers (create, update, remove) and recursively processes widget trees.
5
    ' =====================================================================
6
    class Processor
7

8
        createWidget = Rotor.ViewBuilder.CreateWidget
9
        updateWidget = Rotor.ViewBuilder.UpdateWidget
10
        removeWidget = Rotor.ViewBuilder.RemoveWidget
11

12
        frameworkInstance as Rotor.Framework
13

14
        ' ---------------------------------------------------------------------
15
        ' childProcessor - Processes a single widget configuration (create, update, or remove)
16
        '
17

18
        ' @param {object} postProcessBuffer - Buffer for lifecycle hooks
19
        ' @param {object} config - Widget configuration object
20
        ' @param {string} parentHID - Parent's Hierarchical ID (default: "0")
21
        ' @param {boolean} createFlow - Whether in create-only mode
22
        ' @param {object} params - Processing parameters (default: {})
23
        ' @returns {object} Post-process buffer reference
24
        ' ---------------------------------------------------------------------
25
        function childProcessor(postProcessBuffer as object, config as object, parentHID = "0" as string, createFlow = false, params = {} as object) as object
26

27
            if config?.parentHID <> invalid and config?.parentHID <> "0" then parentHID = config.parentHID
1✔
28

29
            if createFlow = true
2✔
30
                widgets = invalid
1✔
31
            else if config.doesExist("HID")
3✔
32
                widgets = [m.frameworkInstance.builder.widgetTree.getByHID(config.HID)]
1✔
33
            else
3✔
34
                widgets = m.frameworkInstance.builder.widgetTree.find(config.id, parentHID)
1✔
35
            end if
36

37

38
            if widgets = invalid
2✔
39
                result = m.createWidget(postProcessBuffer, config, parentHID)
1✔
40
                newParentHID = result.HID
1✔
41
                newChildren = result.children
1✔
42

43
                ' Run builder processor
44
                if newChildren <> invalid and newChildren.Count() > 0
2✔
45
                    m.run(postProcessBuffer, newParentHID, newChildren, params, true)
1✔
46
                end if
47
            else
48

3✔
49
                for each widget in widgets
1✔
50

51
                    if config?.markedToRemove = true
3✔
52

53
                        result = m.removeWidget(postProcessBuffer, widget, config)
1✔
54

55
                    else
56

3✔
57
                        result = m.updateWidget(postProcessBuffer, widget, config)
1✔
58

59
                    end if
60

61
                    newChildren = result.children
1✔
62
                    newParentHID = result.HID
1✔
63

64
                    if newChildren <> invalid
3✔
65
                        m.run(postProcessBuffer, newParentHID, newChildren, params, createFlow)
1✔
66
                    end if
67

68
                end for
69

70
            end if
71

72
            return postProcessBuffer
1✔
73

74
        end function
75

76
        ' ---------------------------------------------------------------------
77
        ' run - Main entry point for processing widget configurations
78
        '
79

80
        ' @param {object} postProcessBuffer - Buffer for lifecycle hooks
81
        ' @param {string} parentHID - Parent's Hierarchical ID
82
        ' @param {object} children - Child widget configurations
83
        ' @param {object} params - Processing parameters (default: {})
84
        ' @param {boolean} createFlow - Whether in create-only mode (default: false)
85
        ' ---------------------------------------------------------------------
86
        sub run(postProcessBuffer as object, parentHID as string, children as object, params = {} as object, createFlow = false as boolean)
87
            if children.Count() = 0 then return
1✔
88

89
            parsedConfigArray = Rotor.Utils.ensureArray(children)
1✔
90

91
            ' check if should removed
92
            if params?.allowRemove = true
2✔
93
                parentWidget = m.frameworkInstance.builder.widgetTree.getByHID(parentHID)
×
94
                ' if parentWidget <> invalid
95
                for each existingId in parentWidget.children
×
96
                    if -1 = Rotor.Utils.findInArrayByKey(parsedConfigArray, "id", existingId)
×
97
                        parsedConfigArray.push({
×
98
                            id: existingId,
99
                            HID: parentWidget.children[existingId].HID,
100
                            parentHID: parentWidget.children[existingId].parentHID,
101
                            markedToRemove: true
102
                        })
103
                    end if
104
                end for
105
            end if
106

107
            if parsedConfigArray <> invalid and parsedConfigArray.Count() > 0
3✔
108
                for each config in parsedConfigArray
1✔
109
                    if config <> invalid
3✔
110
                        m.checkIdAutoId(config)
1✔
111
                        m.childProcessor(postProcessBuffer, config, parentHID, createFlow, params)
1✔
112
                    end if
113
                end for
114

115
            end if
116

117
        end sub
118

119
        ' ---------------------------------------------------------------------
120
        ' checkIdAutoId - Ensures widget has an ID, generating one if missing
121
        '
122

123
        ' @param {object} config - Widget configuration object
124
        ' @returns {object} Updated configuration with guaranteed ID
125
        ' ---------------------------------------------------------------------
126
        function checkIdAutoId(config as object) as object
127
            hasHID = config.DoesExist("HID")
1✔
128
            if not hasHID and (config.id = invalid or config.id = "")
2✔
129
                id = "ID-" + Rotor.Utils.getUUID() ' generate readable id if missing (This is not the engine's generated HID, this id is the "readable" id)
×
130
                config.id = id
×
131
            end if
132
            return config
1✔
133
        end function
134

135
        ' ---------------------------------------------------------------------
136
        ' init - Initializes the processor with framework instance reference
137
        '
138

139
        ' @param {Rotor.Framework} frameworkInstance - Framework instance reference
140
        ' ---------------------------------------------------------------------
141
        sub init(frameworkInstance as Rotor.Framework)
142
            m.frameworkInstance = frameworkInstance
1✔
143
        end sub
144

145
        ' ---------------------------------------------------------------------
146
        ' destroy - Cleans up framework instance reference
147
        '
148
        ' ---------------------------------------------------------------------
149
        sub destroy()
150
            m.frameworkInstance = invalid
1✔
151
        end sub
152

153

154
    end class
155

156
end namespace
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc