<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: times new roman,new york,times,serif; font-size: 12pt; color: #000000'>Hi guys,<br><br>here comes the most recent revision of UI Plugins proof-of-concept patch (please find it attached).<br><br>There's only one significant change on top of previous revision: the possibility to add custom main tabs :)<br><ul><li><em>MainTabCustomPresenter</em> is the (non-singleton) presenter of the custom tab component<br></li><li><span style="font-style: italic;">MainTabCustomView</span> is the (non-singleton) view of the custom tab component, could be improved to actually show the content of the given URL (e.g. through an iframe)</li><li><span style="font-style: italic;">MainTabCustomProxy</span> is the (non-singleton) presenter proxy implementation<br></li></ul>Here's what happens when a plugin adds a new custom main tab (the process starts at <span style="font-style: italic;">PluginManager.addMainTab</span> method):<br><ul><li><span style="font-style: italic;">MainTabCustomProxyFactory</span> creates new presenter proxy (<span style="font-style: italic;">MainTabCustomProxy</span>)<br></li><li><span style="font-style: italic;">MainTabCustomProxy</span> binds itself to the given place (so that it will be able to respond to GWTP <span style="font-style: italic;">PlaceRequestInternalEvent</span>), creates the "actual" proxy (<span style="font-style: italic;">WrappedProxy</span>) providing actual tab data, and also connects with WebAdmin default gatekeeper (user must be signed into WebAdmin in order to access the place of this custom tab)</li><li>From that point on, the presenter proxy for custom tab component is bound and ready for use</li></ul><p>In GWTP, when main tab panel (e.g. <span style="font-style: italic;">MainTabPanelPresenter</span>) renders its tabs, it fires an event (<span style="font-style: italic;">RequestTabsEvent</span>) saying "any tab which belongs to me, report in". Besides the standard main tab proxies, <span style="font-style: italic;">MainTabCustomProxy</span> instance(s) report in as well, registering themselves into main tab panel through <span style="font-style: italic;">TabContainerPresenter.addTab</span> method. In effect, main tab panel will contain clickable tab headers for all tabs that belong to it.<br></p><p><br></p><p>When the custom tab gets activated, or more precisely, when the custom tab presenter gets revealed (e.g. by clicking custom tab header, or programatically using <span style="font-style: italic;">PlaceManager</span>), GWTP will first ask all proxies "which one handles #custom-tab place", and <span style="font-style: italic;">MainTabCustomProxy </span>indeed responds and hands over its presenter. GWTP presenter reveal flow and view composition gets triggered (bottom-up, from <span style="font-style: italic;">MainTabCustomPresenter</span> right up to <span style="font-style: italic;">RootPresenter</span>), and after reaching the top of presenter hierarchy (<span style="font-style: italic;">RootPresenter</span>), presenter life-cycle methods (such as <span style="font-style: italic;">onReveal</span>, <span style="font-style: italic;">onReset</span>, etc.) are called in a top-down fashion.<br></p><p><br></p><p></p><p></p><p>I've tested this patch using following plugin code (<span style="font-style: italic;">myPlugin.js</span>):</p><p><br></p><p><span style="font-family: courier new,courier,monaco,monospace,sans-serif;">pluginApi.plugins['myPlugin'] = {</span><br style="font-family: courier new,courier,monaco,monospace,sans-serif;"><span style="font-family: courier new,courier,monaco,monospace,sans-serif;"> UiInit: function() {</span><br style="font-family: courier new,courier,monaco,monospace,sans-serif;"><span style="font-family: courier new,courier,monaco,monospace,sans-serif;"> pluginApi.ui.addMainTab('Custom Tab', 'custom-tab', 'http://www.google.com/');</span><br style="font-family: courier new,courier,monaco,monospace,sans-serif;"><span style="font-family: courier new,courier,monaco,monospace,sans-serif;"> }</span><br style="font-family: courier new,courier,monaco,monospace,sans-serif;"><span style="font-family: courier new,courier,monaco,monospace,sans-serif;">};</span><br style="font-family: courier new,courier,monaco,monospace,sans-serif;"><span style="font-family: courier new,courier,monaco,monospace,sans-serif;">pluginApi.ready('myPlugin');</span><br></p><p><br></p><p>As a side note, this PoC patch only adds one kind of custom main tab (the one that is supposed to have its content rendered from the given URL). We could also implement other kinds of custom main tabs, two of which come to my mind right now (this is just an idea for future improvement):</p><ul><li>custom table-based main tab, with API for adding columns, buttons and actual row data</li><li>custom form-based main tab, with API for adding key-value data pairs<br></li></ul><p>Let me know what you think.</p><p><br></p><p>Cheers,<br></p><p>Vojtech<br></p><p><br></p></div></body></html>