Netbeans Platform referencing other module in layer.xml Tips

December 12th, 2008 | by Tonny Kohar |

How do you reference some some instance from other module in the current module layer.xml ? In my case, I need this functionality/features because I create a module that act as branding module. In this branding module I declare the shortcut, windows, menu, etc. The other module is pure API and pure components.

Because of the above requirement I need to find a ways to reference or create instance of something from other module in the branding module, so nbres:// protocols was come to rescue.

In the example below, the settings and wstcref file of the TopComponent is located at other module (Core Module) and the layer.xml below is in the Branding module.

<folder name="Windows2">
    <folder name="Components">
        <file name="BookshelfTopComponent.settings" url="nbres:/kiyut/alkitab/windows/BookshelfTopComponent.settings"/>
        <file name="BookNavigatorTopComponent.settings" url="nbres:/kiyut/alkitab/windows/BookNavigatorTopComponent.settings"/>
        <file name="DefinitionsTopComponent.settings" url="nbres:/kiyut/alkitab/windows/DefinitionsTopComponent.settings"/>
        <file name="DailyDevotionsTopComponent.settings" url="nbres:/kiyut/alkitab/windows/DailyDevotionsTopComponent.settings"/>
    </folder> 
    <folder name="Modes">
        <folder name="explorer">
            <file name="BookshelfTopComponent.wstcref" url="nbres:/kiyut/alkitab/windows/BookshelfTopComponent.wstcref">
                <attr name="position" intvalue="100"/>
            </file>
            <file name="BookNavigatorTopComponent.wstcref" url="nbres:/kiyut/alkitab/windows/BookNavigatorTopComponent.wstcref">
                <attr name="position" intvalue="110"/>
            </file>
        </folder>
        ...
    </folder>
</folder>

For the complete example, you can download the complete source code of Alkitab Bible Study (Public Domain)

Tags: , , , ,

You must be logged in to post a comment.