How to set visibility of a view in a tab when another tab is active

37 Views Asked by At

I have a TabPane which includes 3 different tabs. I load all the views in the tabs with injection. My question is that how to set visibility of a view in one tab when another tab is active. Please check the below fxml code snippet. For example how set visibility of a playView in first tab when my destinationTab is active ? I try but it is not set.

    <TabPane fx:id="tabPane" tabClosingPolicy="UNAVAILABLE" tabMinWidth="130" tabMaxWidth="130">
        <Tab fx:id="sourceTab" text="Source">
            <AnchorPane fx:id="anchorPane" BorderPane.alignment="CENTER">
                <fx:include fx:id="home" source="home.fxml" visible="false"/>
                <fx:include fx:id="popup" source="popup.fxml" visible="false"/>
                <fx:include fx:id="camera" source="camera.fxml" visible="false"/>
                <fx:include fx:id="cctv" source="cctv.fxml" visible="false"/>
                <fx:include fx:id="console" source="console.fxml" visible="false"/>
                <fx:include fx:id="recordSearchHome" source="record_search_home.fxml" visible="false"/>
                <fx:include fx:id="recordSearchPanel" source="record_search_panel.fxml" visible="false"/>
                <fx:include fx:id="recordSearchResult" source="record_search_result.fxml" visible="false"/>
                <fx:include fx:id="logout" source="logout.fxml" visible="false"/>
                <fx:include fx:id="imported" source="imported.fxml" visible="false"/>
                <fx:include fx:id="playView" source="play_view.fxml" visible="false"/>
            </AnchorPane>
        </Tab>
        <Tab fx:id="destinationTab" text="Destination">
            <fx:include fx:id="destination" source="destination.fxml"/>
        </Tab>
        <Tab fx:id="sessionTab" text="Play Sessions">
            <fx:include fx:id="session" source="session.fxml"/>
        </Tab>
    </TabPane>
0

There are 0 best solutions below