A custom CellRenderer in Lemur (Listbox)

@pspeed

Just coming back to this.
Yes, the approach from the WIP threat in the end means you store everything in your database (listbox).
If we think of a list where you can choose a unit from, that would maybe mean 5 pictures (e.g. 5 different cars) and some text per item.
But if we use the same list to show user statistics and you have 5.000 users that would mean 5.000 avatares + 5.000 x some text items (user name, scores etc.).

In the second case that would mean at least 5.000 pictures (Buttons with background pictures) are stored. If whole models (avatars) are stored it would be 5.000 scenes with e.g… (user) models

A better approach would be to store some custom information to the Listbox.
most easy thing would be e.g. String
Example: String S1 = {“UserPicture”,"Link_to_that_picture}
String S2 = {“UserAvatare”,"Link_to_the_model}
In Listbox one would store e.g.
List item 1 = String “Text”
List item 2 = S1
List item 3 = S2

The Cellrenderer then would need to know
list item 1 = use default with existing = new Button(valueToString(value), getElementId(), getStyle());

list item 2 = “Ah its a user picture so do”

Texture txt = getApplication().getAssetManager().loadTexture("Link_to_that_picture");
Button X = new Button("");
X.setBackground(new QuadBackgroundComponent(txt));
existing = X;

list item 3 = “Ah its a user avatar so do”

Spatial Model = assetManager.loadModel("Link_to_the_model");
prepareScene with light, tweens etc. e.g. in a ViewPortpanel -> we call that avatarobject
existing = avatarobject;

The second approach would use much less memory/objects that are stored (e.g. only Strings), the CellRenderer would at least need to have an access to AssetManager.
The first approach would eat a lot of memory, while it does not require the object making during gridrefresh or any access to assetManager etc.

→ What you described here would be the second approach ? You make a Gameitem object. Cell renderer then, depending on an itemid or a name etc., would display it but not (as in the first approach) take the “ready already” item from the storage ?

What about realy realy huge lists e.g. with several million lines → I am sure even with only strings it would make sense to only load like 500 at once to the listbox ?