Generating tab with two tables layout issues

Hi

Sample project attached.

1- When I created localized message for the single Entity the project contains, the messages.properties file has been created with encoding ISO-8859-1 while all the project is UTF-8 (see config extract below)

This is a recurring issue also in my other CUBA based projects, and this is particularly visible in french language for instance.

2- I’ve created a screen “Stock Movement Analysis” which should display movements of stocks for a product with 2 tables side-by-side, one for incoming moves, the other for outgoing moves, globally and warehouse by warehouse.

So i’ve generated tables and tabs and I struggle with the layout:

  • the tables vertical scrollbars go too far beyond the bottom
  • no tables horizontal scrollbars

Tab layout is a vbox contianing a hbox for both tables. In xml I can expand tab content

<tab id="globalTab" caption="Mouvements Stock" expand="globalTable">

But programatically, I did not find how (while guess-trying it would solve issues)

TabSheet.Tab tab = tabSheet.addTab(tabId, vbox);
tab.expand(vbox); // <- method does not exist

3- the tables are not sortable, despite table.setSortable(true)

Regards
Michael

tab2tables.zip (85.5 KB)

  1. It’s Idea behaviour not related to Studio
  2. The expand attribute in XML is set to VBox that is created by loader. You need to call expand for a layout that you create programmatically, e.g.:
TabSheet.Tab generateTab(TabSheet tabSheet, String tabId, String tabCaption, Component... tables) {
    VBoxLayout vbox = uiComponents.create(VBoxLayout.class);
    // make table take all available space
    vbox.setSizeFull();

    HBoxLayout hbox = uiComponents.create(HBoxLayout.class);
    hbox.setWidthFull();
    
    List<Component> comps = Arrays.stream(tables).filter(Objects::nonNull).collect(Collectors.toList());
    float ratio = 1f / comps.size();
    float percent = 100f / comps.size();
    comps.forEach(table -> {
        hbox.add(table);
        // make table take all available space
        table.setHeightFull();
    });
    vbox.add(hbox);
    // expand nested content
    vbox.expand(hbox);

    TabSheet.Tab tab = tabSheet.addTab(tabId, vbox);
    tab.setCaption(tabCaption);
    tabs.put(tabSheet, tab);
    return tab;
}
  1. Data Containers must be created using the DataComponents bean:
@Inject
private DataComponents dataComponents;
...

CollectionContainer<StockMovement> dc = dataComponents.createCollectionContainer(StockMovement.class);

Also, entity attribute localization should be as follows:

String caption = messages.getTools().getPropertyCaption(mpp.getMetaProperty());

Regards,
Gleb

Hi @gorelov

=> right, not fixed since 2017 apparently…

Otherwise, the layout is how I wished, thank you very much.

Michael