MyDoggy... Integrated into the NetBeans Platform!!!

MyDoggy is a really cool Java docking framework... and not only because of its name! Based on the recent blog entry about creating your own window system... I integrated MyDoggy into my own window system implementation... so that your application can look something like this:

Yes, you see two TopComponents, synchronized explorer views, Nodes... and a completely different appearance to what you'd expect from a NetBeans Platform application (yes, it can really look like the above!), simply because I am using the MyDoggy API, within my WindowManager implementation:

protected void initToolWindowManager() {

    // Create a new instance of MyDoggyToolWindowManager passing  the frame:
    MyDoggyToolWindowManager myDoggyToolWindowManager = new MyDoggyToolWindowManager();

    // Register the TopComponent providing the bean tree view:
    myDoggyToolWindowManager.registerToolWindow("BeanTreeView", // Id
            "Bean Tree View", // Title
            null, // Icon
            new View1TopComponent(), //Component
            ToolWindowAnchor.LEFT); // Anchor

    // Register the TopComponent providing the icon view:
    myDoggyToolWindowManager.registerToolWindow("IconView", // Id
            "Icon View", // Title
            null, // Icon
            new View2TopComponent(), //Component
            ToolWindowAnchor.TOP); // Anchor

    // Make all the windows available:
    for (ToolWindow window : myDoggyToolWindowManager.getToolWindows()) {
        window.setAvailable(true);
    }

    // Add myDoggyToolWindowManager to the main window (a JFrame).
    // MyDoggyToolWindowManager is an extension of a JPanel:
    mw.add(myDoggyToolWindowManager, TableLayout.CENTER);

}

Only the following three MyDoggy import statements are needed:

import org.noos.xing.mydoggy.ToolWindow;
import org.noos.xing.mydoggy.ToolWindowAnchor;
import org.noos.xing.mydoggy.plaf.MyDoggyToolWindowManager;

Also:

import info.clearthought.layout.TableLayout;

And, then, in the constructor of the WindowManager implementation, right before setting the main window visible, I call the above method. Yes, so the layer.xml registrations are not used at all: in this case we're registering TopComponents within the WindowManager implementation, not ideal, but it's a starting point for further exploration. Wouldn't take much work to read the registrations from the layer.xml file, so that there'd be no hardcoded views within the WindowManager implementation. In other words, all the values for "MyDoggyToolWindowManager.registerToolWindow" would come from the layer.xml file... meaning that TopComponents could be added from external plugins registering their TopComponents in the layer.xml file of the module providing them! And maybe this way it's sufficient already, if you have control over your WindowSystem implementation, i.e., you're creating your own implementation anyway and you're not expecting external contributions via plugins, so then it doesn't matter that your window system isn't extendable and that you're registering your TopComponents right inside of the WindowManager implementation.

Here's another screenshot, this time showing the NetBeans Platform Paint application (one of the demo applications distributed with NetBeans IDE), using the MyDoggy docking framework instead of the default window system provided by the NetBeans Platform:

Modular MyDoggy-based applications... hmmm... sweet. And let the integration of other window systems begin!

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
21
22
23
24
25
26
27
28
29
30
   
       
Today