Adjust content of the program node when its resized with "<-->/->*<-" button

There is a button under the program tree which changes its width. Some built in nodes (i.e. Move) update their layouts, so all controls stay visible.

I would like to implement the same in our UR cap, but I cannot detect the fact that the size of the node has changed. How can I get this event (Swing)?

Parent view of ProgramNodeView seems to have always the same size 606x407, no matter which state the button “<–>/->*<-” has.

Hi Alexey,

The best way to achieve a responsive layout is to implement your screens using the Swing-based approach, and then use Swing layout managers to control the layout. An introduction is here:

If you absolutely must listen to changes in the amount of screen area available, then the best approach is probably to use a component listener. Read about it here:

M

Hi mry,

thanks for the info on layouts. Still I cannot get expected behavior. This is how I modified helloworld example:

@Override
public void buildUI(JPanel jPanel, final ContributionProvider<HelloWorldProgramNodeContribution> provider) {
    jPanel.setLayout(new FlowLayout());
    for (int i = 0; i < 20; ++i)
        jPanel.add(new JButton(String.format("Button %d", i + 1)));
}

This is how it worked:

It seems to me that jPanels size (buildUI argument) is the same in both cases, so layout alone will not work here. Or did I do something wrong?

I am experiencing the same problem. If the <–> button is pressed, the Swing layout manager doesn’t change anything, as the JPanels size is not modified (if you resize the UR Simulator window, the rest of the JPanel is still visible).

Is this a bug or a feature request? (Or how it is supposed to be?)

I have exactly the same behavior like thomas and alexey. I have not found a solution for supporting both width. So I’ll go for the narrow layout, but it is a wast of space.
I would greatly appreciate if there is a solution (or at least a workaround) for supporting both width.

My recommendation on this matter is to focus on providing a UI that works when the ProgramNode JPanel is wide.
The case when the program tree is expanded (and ProgramNode JPanel is narrow) is mainly designed for the user to navigate the program tree.