My goal is to achieve functionality where user I’ll be able to turn on/off (show/hide) some URCaps from the installation node. To hide program node I need set configuration.setUserInsertable in program node service to false. How I can access this configuration from Installation Node?
I am sure that it can be achieved, because OnRobot has a similar solution. In installation setting for OnRobot URCap you can choose type of gripper. After restart the necessary URCaps appear in Program Tab.
Someone has any suggestion how to do this?
that is not something usually needed. You can, depending on the setting in the installation node, adjust the UI in the program nodes to let user know, that it node is no longer fully configured according to the settings in the installation node. This would avoid the need of a robot reboot.
If you would like to toggle the visibility completely, you need a way to store this information persistent between reboots. As the Data model is not available in this stage, storing a config file with the desired behavior could be a possible solution.
@sko thank you for reply,
What you propose may be a better solution, but still I’m curious how to achieve that functionality?
In my URCap I have one installation node and several program nodes. From program node I can easy cal method belong to installation node.
MyInstallationNodeContribution installationNode = apiProvider.getProgramAPI().getInstallationNode(MyInstallationNodeContribution.class); installationNode.someMethod();
But how can I do other way round? Can I reach program node method from installation node?
E.g. after changing some setting in installation node I also wanna change settings in all inserted program nodes from my URCap.
you would reach out from the Program Node to the installation node, on its creation and e.g. on the openView() - Method being called. To avoid the wrong Script Code being provided the status should also be checked using the approach shown in your answer in the ScriptWriter() - Method.
So you need to store the information only once in the installation and each program node reads it when needed.
Thank you for advice. However I’m still wander haw to do some kind of callback?
Here is another example: I have installation settings and toolbar as below. I managed to achieve a functionality where changes in the toolbar are reflected in installation setting.
How I can do other way round? I would like slider in toolbar to move with the slider from the installation config etc.
With the toolbar you can start a TimerTask with the openview() - Method.
The setToolbarDurationSlider() - Method is setting the currently stored value read out form the installation nodes datamodel.
The 200 parameter defines the time period in ms between each function call, but it does not run as smooth as if it was triggered from the changeListener inside the slider.
In the closeView() - Method you would then stop the timerTask again.