RollupPanel: Node is not a child of this layout

When calling setContents(null) of the RollupPanel while its collapsed it causes a:

java.lang.RuntimeException: Node is not a child of this layout.
    at com.simsilica.lemur.component.BorderLayout.removeChild(BorderLayout.java:221)
    at com.simsilica.lemur.RollupPanel.setContents(RollupPanel.java:113)

Because the contents is currently not part of the BorderLayout (because its collapsed).

Ahah… thanks again.

I don’t have a test to try it… so if you get a chance then just let me know if it fixes the issue.

I’ll probably cut new releases this weekend if you don’t want to build from source.

Currently I am using the released versions, but I think I will be switching tomorrow or so to the git version, then I will test it and let you know.

Btw, two things that would be nice (are currently a reason I cannot use your versions):

  • ColorChooser → Would be nice if the sizes of the slider and both color textures could be changed - maybe thats possible using styles. But I am using them inside a grid, which results in an exception during the invalidation process of the layout (because some width becomes negative) if the component is to big for my grid
  • GridPanel → Would be nice if there is a way to set the fill mode (in my case minorFill) of the layout from outside or within the constructor. I needed Proportional to get a reasonable width of the components

I should probably expose the children in getters. Some of what you request I think is possible through styling as those elements definitely use styling. The element ID of the slider should be something like colorChooser.brightness.slider or something like that.

But anyway, exposing the children through getters is something I’ve been trying to complete for all of the composite elements like this.

Hmm… well, first, you absolutely can set a custom layout. There is no direct method to do it but you can grab the layout from the GuiControl and replace it or whatever. You might have to set the model again.

GridPanel was supposed to force everything to be the same size but maybe that’s too extreme even for the general case. Can you explain more about your use-case?

I have a list of properties and two columns. One for the label (name of the component) and one dynamic component (Slider, ColorChooser, …) for the value of the properties. The first column should be as small as possible (so that all the names fit) and the rest of the space should be taken by the value component.

And you are scrolling through them or something? (Like, that’s why a normal container won’t work?)

When I envisioned using GridPanel for things like Tables it was where each column got its own one-column GridPanel and the visible row was synched across the table. Ultimately, I think it’s the only way to keep things happy in an environment like that (and lets the columns get reordered and stuff).

Depending on how you’ve hooked up scrolling to a two column panel then you may be able to get away the same thing. Unless you’ve somehow coerced ListBox into doing this then a) cool and b) yeah, I can see how that would be an issue. :slight_smile:

Anyway, in the mean time, if you delay setting the model then you can just call:
myPanel.getControl(GuiControl.class).setLayout(new SpringGridLayout(whatever options you want));
…then myPanel.setModel().

Thx, my current solution was just to copy the GridPanel and change the constructor maybe I will switch back to the standard control later and use your setLayout “trick”. But currently its not an issue because I am still only prototyping. I think I will need to implement a few controls later anyway and then I can think about some better controls (like using radio buttons instead of listboxes).