The last dockable of a DockstackStation looses its title

Hi,

I have a StackStation that contains 3 dockables. The three dockables have a title and an icon and all those dockables are closeable.
When I close a first dockable, the StackDockStation will contains 2 dockables with a title, icon and the close button
When I close the second, the last dockable lost its title and icon and I’m not able to close it
Could you please check if I’m doing something wrong?

public class Demo03_Theme {

    public Demo03_Theme() {
        // create a frame
        JFrame frame = new JFrame("Demo");
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.setSize(600, 500);

        DockController controller = new DockController();
        controller.setTheme(new EclipseTheme());
        controller.getProperties().set(EclipseTheme.PAINT_ICONS_WHEN_DESELECTED, true);
        final StackDockStation station = new StackDockStation();
        frame.add(station.getComponent(), BorderLayout.CENTER);
        controller.add(station);

        for (int i = 0; i < 3; i++) {
            JPanel panel = new JPanel();
            panel.setLayout(new FlowLayout());
            panel.add(new JButton("Button"));
            panel.setOpaque(true);
            DefaultDockable dockable = new DefaultDockable(panel, "Dockable " + i);
            dockable.setTitleIcon(new ImageIcon(getClass().getClassLoader().getResource("demo/flap_south.png")));
            station.drop(dockable);
            CloseAction closeAction = new CloseAction(controller) {
                @Override
                protected void close(Dockable dockable) {
                	int dockableIndex = station.indexOf(dockable);
                	station.remove(dockableIndex);
                	station.getComponent().repaint();
                }
            };
            // Creates a list of DockActions that contains a single action which is the closeAction
            DefaultDockActionSource source = new DefaultDockActionSource(new LocationHint(LocationHint.DOCKABLE, LocationHint.LEFT), closeAction);
            // Sets the below defined action to this Dockable
            dockable.setActionOffers(source);
        }
        frame.setVisible(true);
    }


    public static void main(String[] args) {
        new Demo03_Theme();
    }
}

Thank you,

I’ll have to test this, the title should of course not disappear.

To my defense: A StackDockStation with only one child hardly ever exists. Normally a StackDockStation is a child of some other station and if it has only one child left it gets automatically replaced by its child.

Hi Beni,

Any news about this issue?

Thank you,

Ah, I’ve “repaired” that behavior*. The new version is in the repository but not yet on the homepage.

  • Actually “looses its title” is not 100% correct, “looses its tab” would be correct. If you would use another theme the problem would look much less scary because then the Dockable would have a real title.