| 115 | } |
| 116 | |
| 117 | void ModuleRouterView::setRouter(ModuleRouter * router) |
| 118 | { |
| 119 | if (currentRouter == router) return; |
| 120 | if (currentRouter != nullptr) |
| 121 | { |
| 122 | if (!currentRouter->isClearing) |
| 123 | { |
| 124 | currentRouter->removeRouterListener(this); |
| 125 | currentRouter->removeInspectableListener(this); |
| 126 | } |
| 127 | |
| 128 | removeChildComponent(selectAllTrigger.get()); |
| 129 | selectAllTrigger.reset(); |
| 130 | removeChildComponent(deselectAllTrigger.get()); |
| 131 | deselectAllTrigger.reset(); |
| 132 | removeChildComponent(routeAllTrigger.get()); |
| 133 | routeAllTrigger.reset(); |
| 134 | |
| 135 | removeChildComponent(&sourceChooser); |
| 136 | removeChildComponent(&destChooser); |
| 137 | |
| 138 | removeChildComponent(&sourceValueLabel); |
| 139 | removeChildComponent(&feedbackLabel); |
| 140 | removeChildComponent(&outParamsLabel); |
| 141 | |
| 142 | sourceChooser.setSelectedItemIndex(-1, dontSendNotification); |
| 143 | destChooser.setSelectedItemIndex(-1, dontSendNotification); |
| 144 | } |
| 145 | |
| 146 | currentRouter = router; |
| 147 | |
| 148 | if (currentRouter != nullptr) |
| 149 | { |
| 150 | currentRouter->addRouterListener(this); |
| 151 | currentRouter->addInspectableListener(this); |
| 152 | |
| 153 | addAndMakeVisible(&sourceChooser); |
| 154 | addAndMakeVisible(&destChooser); |
| 155 | addAndMakeVisible(&sourceValueLabel); |
| 156 | addAndMakeVisible(&feedbackLabel); |
| 157 | addAndMakeVisible(&outParamsLabel); |
| 158 | sourceChooser.setModuleSelected(currentRouter->sourceModule,true); |
| 159 | destChooser.setModuleSelected(currentRouter->destModule,true); |
| 160 | |
| 161 | selectAllTrigger.reset(currentRouter->selectAllValues->createButtonUI()); |
| 162 | deselectAllTrigger.reset(currentRouter->deselectAllValues->createButtonUI()); |
| 163 | routeAllTrigger.reset(currentRouter->routeAllValues->createButtonUI()); |
| 164 | addAndMakeVisible(selectAllTrigger.get()); |
| 165 | addAndMakeVisible(deselectAllTrigger.get()); |
| 166 | addAndMakeVisible(routeAllTrigger.get()); |
| 167 | |
| 168 | } else |
| 169 | { |
| 170 | sourceChooser.setModuleSelected(nullptr,true); |
| 171 | destChooser.setModuleSelected(nullptr,true); |
| 172 | } |
| 173 | |
| 174 | updateRouterControllerUI(); |
nothing calls this directly
no test coverage detected