As we know that ,there are 6 types of controllers:
- Component controller
- Custom controller
- Configuration controller
- Interface controller
- View controller
- Window controller
Then what is the configuration controller?
Configuration controller in turns a custom controller.
What is the use of Configuration controller?
It is necessary if the corresponding component implements special configuration and personalization.
Eg: Setting the visibility of a view element dynamically for different users
Instead of writing code to set visibility we can maintain the visibility in configuration. Each user group can have their own visibility settings through configuration.
All attributes that should be accessible via configuration have to be defined in the context of the configuration controller.
Limitations of Configuration controller:
– Only one configuration controller may exist in any component.
– Any controller can access the configuration controller, but configuration controller cannot access any other controller.
– Life time of this controller is as long as the component lives.
Creation of configuration controller:
Step1: Create a WD component
Step2: Create a Custom controller by right clicking on component
Step3: Now you can see the extra folder in component hierarchy for custom controller.
Step4: Change the custom controller to configuration controller by right clicking on the custom controller
Step5: Now you can see that, name has been changed to configuration controller.
Like component controller, we can create context attributes in custom controller.
Nodes which we created in configuration controller will be available during configuration.
Now create a node for visibility with type WDY_BOOLEAN.
Step6: Create a context node in view controller and place the UI elements in the view
Step7: Unlike component controller, configuration controller context will not be available to view controller. To make it available, create component usage in view controller properties.
Step8: Map the context from configuration controller to view controller.
Step9: We want to set the visibility through configuration to material number UI element.
So bind the visibility of material number with visibility node.
Step10: Create WD application
Right click on application and click on create/change configuration
Step11: One browser window will open to create application configuration.
Enter the configuration name and click on create
Step12: Enter the package name and click on OK
Step13: We have created now application configuration, Next screen prompt you to create Component configuration.
Enter the configuration name and hit enter. After hitting enter ‘Go to Component Configuration’ button will be enabled.
– Step14: Click on ‘Go to Component Configuration’ button
– Step15:In the next screen enter the configuration name and click on create and save it into one package
Step16: Node attributes which we created in Configuration controller will be available in Component configuration.
Step17: Now check the visibility check box to make the input field visible and Click on Save
Step18: Before testing the configuration make sure that, all configurations (Both application and component configurations) has been saved.
Now expand the application, there you can see the application configuration which we have created.
Assign the application name to the application parameter WDCONFIGURATIONID
Step 19: Test the application
Step 20: Now change the configuration to make the material number UI element invisible.
Double click on configuration. Click on start configurator.
Step 21: Click on Change
Step22:Click on the button ‘Go to Component configuration’.
Uncheck the visibility attribute and click on Save.
Step 23: Test the Application.
Conclusion: Each application can have N number of configurations. So each user group can set their visibility according to their requirement without touching the code.