Maximize of a DefaultSingleCDockable

Hi,

I have the below example and

  1. When I click on the Maximize button of the “Red” dockable, it doesn’t get maximized.
  2. When I click on the externalize button [Disconnect this panel from the frame] then [Connect this panle to the frame] the “Red” dockable looses it initial size.

Could you please advice?

package test;

public class Example5 {
    public Example5() {
    }

    public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.getContentPane().setLayout(new BorderLayout());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        CControl control = new CControl(frame);
        CContentArea contentArea = control.createContentArea("root_content_area");

     	frame.getContentPane().add(contentArea, BorderLayout.CENTER);

        control.putProperty(CControl.RESIZE_LOCK_CONFLICT_RESOLVER, new FullLockConflictResolver());
        frame.setLayout(new GridLayout(1, 1));

        DefaultSingleCDockable red = create("Red", Color.RED);
        control.addDockable(red);

        DefaultSingleCDockable green = create("Green", Color.GREEN);
        control.addDockable(green);
        DefaultSingleCDockable blue = create("Blue", Color.BLUE);
        control.addDockable(blue);

        DefaultSingleCDockable gray1 = create("gray1", Color.GRAY);
        control.addDockable(gray1);
        DefaultSingleCDockable gray2 = create("gray2", Color.GRAY);
        control.addDockable(gray2);

        CGrid grid = new CGrid();

        grid.add(0, 0, 1, 1, red);
        grid.add(1, 0, 1, 1, green);
        grid.add(2, 0, 1, 1, blue);
        grid.add(1, 1, 1, 1, gray1);
        grid.add(1, 1, 1, 1, gray2);
        contentArea.deploy(grid);

        freeze(red);
        freeze(blue);
        freeze(green);

        frame.setSize(new Dimension(500, 500));
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }

    static void freeze(DefaultSingleCDockable dockable) {
        dockable.setCloseable(false);
        dockable.setMaximizable(false);
        dockable.setMinimizable(false);
        dockable.setResizeLocked(true);
    }

    static DefaultSingleCDockable create(String title, Color color) {
        JPanel panel = new JPanel();
        panel.setOpaque(true);
        panel.setBackground(color);
        DefaultSingleCDockable singleCDockable = new DefaultSingleCDockable(title, title, panel);
        singleCDockable.setMaximizable(true);
        singleCDockable.setCloseable(true);
        singleCDockable.setMinimizable(true);
        return singleCDockable;
    }
}


Regards,

Not maximizing: because you called “freeze” and there “setMaximizeable(false)”. The buttons should not even show up, that’s a bug I’ll have to repair. For now please call “freeze” before “deploy” to hide the buttons.

[Edit: this bug is now fixed and the fix will be distributed with the next release]

Size: that is due to the call to “dockable.setResizeLocked(true)”. The blue and the green dockable are locked in their size, hence they do not want to give “red” any space. As result “red” gets the minimium size assigned that a Dockable can have.
Maybe the behavior is a bit unexpected, especially since the size of “red” is locked as well. I’ll put that on the todo-list. It’s not a bug, just a feature that was never implemented.

Oups, I miss the freeze method

Thank you for the additional infos