How to add a SplitDockStation to a CControl?

Hi!

Is there any way to add a SplitDockStation to a CControl? maybe I need to wrap SplitDockStation in a CStation but I don’t get the way to do it.
This a example code:

import bibliothek.gui.Dockable;
import bibliothek.gui.dock.DefaultDockable;
import bibliothek.gui.dock.SplitDockStation;
import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.common.CStation;
import bibliothek.gui.dock.common.DefaultSingleCDockable;
import bibliothek.gui.dock.station.split.DockableSplitDockTree;
import java.awt.Dimension;
import javax.swing.JFrame;

public class TestA {
    
    JFrame frame;
    CControl control;
    
    public void init() {
        frame = new JFrame("App");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        control = new CControl(frame);
        
        frame.add(control.getContentArea());

        frame.setSize(new Dimension(400, 400));
        frame.setVisible(true);
    }
    
    public void asd() {
        DefaultSingleCDockable d = new DefaultSingleCDockable("1");
        control.addDockable(d);
        d.setVisible(true);
    }
    
    public void test() {
        control.getController().add(createLayoutTree());
        System.out.println(control.getCDockableCount());
        for (int i = 0; i < control.getCDockableCount(); i++) {
            System.out.println(control.getCDockable(i).isShowing());
        }
    }
    
    private static SplitDockStation createLayoutTree(){
        SplitDockStation station = new SplitDockStation();
        station.setTitleText("Tree");

        Dockable red = new DefaultDockable("red");
        Dockable green =  new DefaultDockable("green");
        Dockable blue = new DefaultDockable("blue");
        Dockable yellow = new DefaultDockable("yellow");
        Dockable cyan = new DefaultDockable("cyan");
        Dockable magenta = (new DefaultSingleCDockable("magenta")).intern();

        DockableSplitDockTree tree = new DockableSplitDockTree();

        DockableSplitDockTree.Key group = tree.put( new Dockable[]{ red, green, blue }, green );
        DockableSplitDockTree.Key bottomRight = tree.horizontal( cyan, magenta, 1.0/3.0 );
        DockableSplitDockTree.Key keyYellow = tree.put( yellow );
        DockableSplitDockTree.Key right = tree.vertical( keyYellow, bottomRight, 0.3 );
        DockableSplitDockTree.Key root = tree.horizontal( group, right, 0.4 );

        tree.root( root );
        station.dropTree( tree );
        
        return station;
    }
    
    public static void main(String[] args) {
        TestA app = new TestA();
        app.init();
        //test.asd();
        app.test();
    }
}

I need this because i’m creating the layout from a DockableSplitDockTree.

Thank you!

Mixing items from the core project (like Dockable or SplitDockStation) with CControl will not end well. If you really need additional SplitDockStations, use “CControl.createGridArea”, “createContentArea” or “createWorkingArea”. Usually applications have one central “CContentArea”, and maybe an additional “CWorkingArea” in which they show things like text-editors.

Instead of DockableSplitDockTree I suggest to use CGrid, and the method “CContentArea.deploy”. CGrid is just a factory for a tree, but it should be easier to use because you just have to define the location and size of CDockables and CGrid figures out how the tree has to look like (or if you really want to use the tree, you can call “CGridArea.intern().dropTree…”)

Thank you Beni! Since I had a tree, I had to figure out the algorithm to make the grid from it, but I made it!
(I thought CGrid it was more like a chessboard, but I was wrong, It is very flexible)

Ty again