Page 1 of 1

DisplayLogic Responsive to Plugin

PostPosted: Mon Sep 04, 2017 7:43 pm
by red1
(I wanted to do this for a long time and finally Hiep LQ gave me a good tip to use Env.setCtx.) We can make a DisplayLogic respond to whether a Plugin is present or not. For example i could make the BackOrder Management Info-Window CreateShipment Process button to disappear or appear accordingly.
Below is when the WMS Plugin is installed. Note the process buttons.

PluginInstalled.png (44.7 KiB) Viewed 4304 times
And when it is unsinstalled and restarted, the button disappeared when records are selected.

PluginAbsent.png (37.04 KiB) Viewed 4304 times
Below is how it is done. First we set the Plugin Event to record and set in Env Ctx() a value. In this case #WMS='Y'.

SetPluginInCtx.png (33.37 KiB) Viewed 4304 times
Then in the InfoProcess' DisplayLogic.

InfoProcessDIsplayLogic.png (47.14 KiB) Viewed 4304 times
Here both plugins (BackOrder and WMS) could work more independently of each other. The code for CreateShipment can be in the other plugin and when that plugin is not installed, the process from there is not displayed in the calling plugin for use.

Thus a not found process classname error cannot occur as there is no button to call it in the first place! This is also perhaps the very first time iDempiere's OSGi feature can be made visible in the UI.