UI Constraints not availbe for MainView and Fragments

Can we define UI constraints for MainView and Fragments. Both are available in dropdown window but component id list is always blank.

secondly, can the dropdown can have inline search as picking the view is very cumbersome if there are a lot of view are in project and views are also not sorted.

Thanks

Hi!

In fact, event if fragments are not presented as a selection option in the dropdown list of available views, they are still available as a nested element in the view.

To explain it more clearly, I will show you an example.

Let’t imagine that I have a fragment like this in my project:

<fragment xmlns="http://jmix.io/schema/flowui/fragment">
    <content>
        <vbox id="root">
            <button id="button" text="Button"/>
            <hbox id="layout">
                <span id="span" text="Span"/>
            </hbox>
        </vbox>
    </content>
</fragment>

And I added this fragment to my BlankView:

<view xmlns="http://jmix.io/schema/flowui/view"
      title="msg://blankView.title">
    <layout>
        <fragment id="fragment" class="com.company.bugfix251.view.blankfragment.BlankFragment"/>
    </layout>
</view>

When trying to set UI constraints policies for the BlankView, nested components from the fragment will be available for selection:
image

As for selection components ID from MainView, it also works as far as I can see:
image

This way you can use UI Constraints policy with both fragments and the MainView.

As for your second question, about inline search in view and component dropdown. That works too, as far as I can see:
image
image

Best regards,
Dmitriy

Thanks @d.kremnev
I was adding fragment to main view but my main view ui constraint screen is always blank.
Screenshot 2025-03-21 104933

Also why your UI and my UI is dirrefent? I have listbox instead of dropdow.

Hi!

Could you please provide the XML descriptor code of your MainView? Have you specified the ID for the fragment XML element?

Dmitriy

XML code for MainView

> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <mainView xmlns="http://jmix.io/schema/flowui/main-view"
>           title="msg://MainView.title">
>     <actions>
>         <action id="logoutAction" type="logout"/>
>     </actions>
>     <appLayout>
>         <navigationBar>
>             <header id="header" classNames="jmix-main-view-header">
>                 <drawerToggle id="drawerToggle"
>                               classNames="jmix-main-view-drawer-toggle"
>                               themeNames="contrast"
>                               ariaLabel="msg://drawerToggle.ariaLabel"/>
>                 <h1 id="viewTitle" classNames="jmix-main-view-title"/>
>             </header>
>         </navigationBar>
>         <drawerLayout>
>             <section id="section" classNames="jmix-main-view-section">
>                 <h2 id="applicationTitle"
>                     classNames="jmix-main-view-application-title">
>                     <anchor id="baseLink"
>                             href="."
>                             text="msg://applicationTitle.text"
>                             classNames="jmix-main-view-application-title-base-link"/>
>                 </h2>
>                 <nav id="navigation"
>                      classNames="jmix-main-view-navigation"
>                      ariaLabel="msg://navigation.ariaLabel">
>                     <listMenu id="menu"/>
>                 </nav>
>                 <footer id="footer" classNames="jmix-main-view-footer">
>                     <userIndicator id="userIndicator"/>
>                     <button id="logoutButton"
>                             action="logoutAction"
>                             classNames="jmix-logout-button"/>
>                 </footer>
>             </section>
>         </drawerLayout>
>         <initialLayout id = "id1">
>             <fragment id = "frag1" class="com.company.highlightpdf.view.blankfragment.BlankFragment"/>
>         </initialLayout>
>     </appLayout>
> </mainView>

I thick the top element should be only then in “UI contraint” component IDs are viisble.

In tabbed layout even vBox etc are also not visible, it may be due to my other post How to show image/fragment in initial layout in tabbed window mode

Thanks and Regards.