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!