Blog

  • Master Detail with multiple fragments for detail and single controller in SAP UI5

    Preface – This post is part of the UI5 Programs series.

    In this article, we will learn Master Detail with multiple fragments for detail and a single controller in SAP UI5. Visit this page, in case you are looking for Master Detail with multiple views and multiple controllers for detail

    Master Detail with multiple fragments for detail and single controller in SAP UI5

    Main.view.xml

    In this use case, our Application name is YRR. We have used tnt:ToolPage to create Master and Detail sections. Within detail, you will see multiple fragments within ScrollContainer. All the tab names are specified within tnt:Side Navigation. On click of these tabs, their functions are called which navigates the view with the help of Scroll Containers ID.

    <mvc:View xmlns:core="sap.ui.core" controllerName="YRR.YRR.controller.Main" xmlns:mvc="sap.ui.core.mvc" xmlns:tnt="sap.tnt"
        xmlns:html="http://www.w3.org/1999/xhtml" displayBlock="true" xmlns="sap.m"
        xmlns:custom="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1">
        <!--<App id="idAppControl">-->
        <tnt:ToolPage id="toolPage">
            <tnt:header>
                <tnt:ToolHeader>
                    <Button id="sideNavigationToggleButton" icon="sap-icon://menu2" type="Transparent" press="onCollapseExpandPress">
                        <layoutData>
                            <OverflowToolbarLayoutData priority="NeverOverflow"/>
                        </layoutData>
                    </Button>
                    <ToolbarSpacer/>
                    <core:Icon src="sap-icon://vehicle-repair"></core:Icon>
                    <Text text="{i18n>title}" wrapping="false">
                        <layoutData>
                            <OverflowToolbarLayoutData priority="Disappear"/>
                        </layoutData>
                    </Text>
                    <ToolbarSpacer/>
                    <Button text="Download User Excel" icon="sap-icon://excel-attachment" type="Transparent" press="onSelectExtendedUser"/>
                    <Text text="{i18n>version}" wrapping="false"/>
                    <!--<Button icon="sap-icon://bell" press="handleMessagePopoverPress"/>-->
                </tnt:ToolHeader>
            </tnt:header>
            <tnt:sideContent>
                <tnt:SideNavigation expanded="true" selectedKey="root0">
                    <tnt:NavigationList>
                        <tnt:NavigationListItem text="Users" key="root0" icon="sap-icon://account" expanded="true" select="onSelectUser"/>
                        <!--<tnt:NavigationListItem text="Download User Excel" key="root1" icon="sap-icon://excel-attachment" expanded="true"-->
                        <!--	select="onSelectExtendedUser"/>-->
                        <tnt:NavigationListItem text="Insurance" key="root2" icon="sap-icon://insurance-car" expanded="true" select="onSelectInsurance"/>
                        <tnt:NavigationListItem text="Transactions" key="root3" icon="sap-icon://vehicle-repair" expanded="true" select="onSelectTransactions"/>
                        <tnt:NavigationListItem text="Controller &amp; Driver" key="root4" icon="sap-icon://manager" expanded="true" select="onSelectController"/>
                        <tnt:NavigationListItem text="Car Plates" key="root5" icon="sap-icon://add-contact" expanded="true" select="onSelectCarPlates"/>
                        <tnt:NavigationListItem text="Promotion &amp; Rewards" icon="sap-icon://loan" expanded="false">
                            <tnt:NavigationListItem text="Promotion" key="root6" icon="sap-icon://payment-approval" expanded="true" select="onSelectPromotion"/>
                            <tnt:NavigationListItem text="Rewards" key="root7" icon="sap-icon://loan" expanded="true" select="onSelectRewards"/>
                            <tnt:NavigationListItem text="Specific Rewards" key="root7_1" icon="sap-icon://loan" expanded="true" select="onSelectSpecificRewards"/>
                        </tnt:NavigationListItem>
                        <tnt:NavigationListItem text="Notifications" icon="sap-icon://sales-notification" expanded="false">
                            <tnt:NavigationListItem text="App Notification" key="root8" icon="sap-icon://sales-notification" expanded="true"
                                select="onSelectNotification"/>
                            <tnt:NavigationListItem text="Manual Push Notification" key="root8_1" icon="sap-icon://sales-notification" expanded="true"
                                select="onSelectPushNotification"/>
                        </tnt:NavigationListItem>
                        <tnt:NavigationListItem text="Home Images" icon="sap-icon://background" expanded="false">
                            <tnt:NavigationListItem text="Promo Images" key="root9_1" icon="sap-icon://background" expanded="true" select="onSelectPromoImages"/>
                            <tnt:NavigationListItem text="Dashboard Images" key="root9_2" icon="sap-icon://background" expanded="true" select="onSelectDashboardImages"/>
                            <tnt:NavigationListItem text="Dashboard Icons" key="root9_3" icon="sap-icon://background" expanded="true" select="onSelectDashboardIcons"/>
                        </tnt:NavigationListItem>
                        <tnt:NavigationListItem text="Master Data" icon="sap-icon://accounting-document-verification" expanded="false">
                            <tnt:NavigationListItem text="Terms &amp; Conditions" key="root12" icon="sap-icon://activities" expanded="true" select="onSelectTerms"/>
                            <tnt:NavigationListItem text="Car Brands" key="root10" icon="sap-icon://insurance-car" expanded="true" select="onSelectCarBrands"/>
                            <tnt:NavigationListItem text="Organizations" key="root13" icon="sap-icon://insurance-car" expanded="true" select="onSelectOrg"/>
                        </tnt:NavigationListItem>
                        <tnt:NavigationListItem text="Enquiry" key="root11" icon="sap-icon://headset" expanded="true" select="onSelectInquiry"/>
                    </tnt:NavigationList>
                    <tnt:fixedItem>
                        <tnt:NavigationList >
                            <tnt:NavigationListItem text="Log Out" icon="sap-icon://log" select="onSelectLogOut"/>
                        </tnt:NavigationList>
                    </tnt:fixedItem>
                </tnt:SideNavigation>
            </tnt:sideContent>
            <tnt:mainContents>
                <NavContainer id="pageContainer" initialPage="root1">
                    <pages>
                        <ScrollContainer id="root0" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.UserDetails" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root1" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.ExtendedUserDetails" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root1_1" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.UserOvp" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root2" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.InsuranceDetails" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root2_1" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.InsuranceOvp" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root3" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.Transaction" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root4" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.Controller" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root5" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.CarPlates" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root5_1" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.CarPlatesOvp" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root6" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.Promotion" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root7" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.Rewards" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root7_1" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.SpecificRewards" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root8" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.Notification" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root8_1" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.PushNotification" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root9_1" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.PromoImages" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root9_2" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.HomeImages" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root9_3" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.DashboardIcons" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root10" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.CarDetails" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root11" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.Inquiry" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root12" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.TermsConditions" type="XML"/>
                        </ScrollContainer>
                        <ScrollContainer id="root13" horizontal="false" vertical="true" height="100%">
                            <core:Fragment fragmentName="YRR.YRR.fragment.Organizations" type="XML"/>
                        </ScrollContainer>
                    </pages>
                </NavContainer>
            </tnt:mainContents>
        </tnt:ToolPage>
        <!--</App>-->
    </mvc:View>

    Output of tnt:SideNavigation:

    Content of Side Navigation

    Main.controller.js

    // the function used to show the User Fragment
    onSelectUser: function (oEvent) {
    // "pageContainer" is the ID of NavContainer within which all the ScrollContainer are added
    // "root0" is the ID of first ScrollContainer within which we have a fragment called "UserDetails"
                this.byId("pageContainer").to(this.getView().createId("root0"));
        },
    
    
    

    No special navigation handling is required within the Manifest file.

    Fragment: UserDetails.fragment.xml

    This Fragment will open when onSelectUser is clicked.

    <core:FragmentDefinition xmlns="sap.m" xmlns:l="sap.ui.layout" xmlns:f="sap.ui.layout.form" xmlns:core="sap.ui.core"
        xmlns:u="sap.ui.unified" xmlns:commons="sap.suite.ui.commons">
        <OverflowToolbar>
            <Title text="User Data ({AppConfig>/UserCount})" level="H2"/>
            <ToolbarSpacer/>
            <Button text="Sort" icon="sap-icon://sort" press="handleUserSort"/>
        </OverflowToolbar>
        <Table id="idUserTable" inset="false" items="{/Users}" sticky="ColumnHeaders,HeaderToolbar" class="sapFDynamicPageAlignContent" width="auto">
            <headerToolbar>
                <OverflowToolbar>
                    <SearchField id="idSearchUserName" placeholder="Search Name" value="" search="onSearchName" width="15rem"/>
                    <SearchField id="idSearchUserPhone" placeholder="Search Phone Number" value="" search="onSearchPhone" width="15rem"/>
                    <SearchField id="idSearchUserEmail" placeholder="Search Email ID" value="" search="onSearchUser" width="15rem"/>
                    <SearchField id="idSearchUserOrg" placeholder="Search Organization" value="" search="onSearchOrg" width="15rem"/>
                </OverflowToolbar>
            </headerToolbar>
            <columns>
                <Column minScreenWidth="Tablet" demandPopin="true">
                    <Text text="User Name"/>
                </Column>
                <Column minScreenWidth="Desktop" demandPopin="true" hAlign="End">
                    <Text text="Email ID"/>
                </Column>
                <Column minScreenWidth="Desktop" demandPopin="true" hAlign="Center">
                    <Text text="Phone Number"/>
                </Column>
                <Column minScreenWidth="Desktop" demandPopin="true" hAlign="Center">
                    <Text text="Date of Birth"/>
                </Column>
                <Column minScreenWidth="Desktop" demandPopin="true" hAlign="Center">
                    <Text text="Organization"/>
                </Column>
            </columns>
            <items>
                <ColumnListItem type="Navigation" press="onUserPress">
                    <customData>
                        <core:CustomData key="idUserTable"/>
                    </customData>
                    <cells>
                        <Text text="{userName}"/>
                        <Text text="{email}"/>
                        <Text text="{mob}"/>
                        <Text text="{ path: 'dob', formatter: '.formatter.dateUnit' }"/>
                        <Text text="{org}"/>
                        <!--<Select id="iduserRole" selectedKey="{userRole}" change="onSelectUserRole">-->
                        <!--	<core:Item key="BASIC" text="BASIC"/>-->
                        <!--	<core:Item key="SG Member" text="SG Member"/>-->
                        <!--	<core:Item key="SGMY Member" text="SGMY Member"/>-->
                        <!--</Select>-->
                    </cells>
                </ColumnListItem>
            </items>
        </Table>
        <Bar design="SubHeader" id="idLoadMore">
            <contentMiddle>
                <VBox height="100%" alignItems="Center">
                    <Button text="Load Next 20 Data >>" press="onMoreUsers"/>
                </VBox>
            </contentMiddle>
            <contentRight>
                <Input type="Number" id="pageNumber" width="50px"></Input>
                <Button id="goToButton" text="Go to" type="Emphasized" press="onHandleGoTo"></Button>
            </contentRight>
        </Bar>
        <VBox id="idLoadSortMore" height="100%" alignItems="Center" visible="false">
            <Button text="Load Next 20 Data >>" press="onMoreSortUsers"/>
        </VBox>
    </core:FragmentDefinition>

    Output of Fragment:

    Content of Fragment

  • Master Detail with multiple views and multiple controllers for detail in SAP UI5

    Preface – This post is part of the UI5 Programs series.

    In this article, we will discuss Master Detail with multiple views and multiple controllers for detail in SAP UI5. Visit this page, in case you are looking for Master Detail with multiple fragments for detail and a single controller.

    Master Detail with multiple views and multiple controllers for detail in SAP UI5

    App.view.xml

    The UI5 App name in our use case is “admin”.

    <mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
        controllerName="admin.admin.controller.App" xmlns:html="http://www.w3.org/1999/xhtml">
        <Shell id="shell">
            <App id="app">
                <pages>
                    <!--Split App to Enable Master Detail Configuration-->
                    <SplitApp id="Splitapp" mode="HideMode"></SplitApp> 
                   // delete mode if you wan't to always show the Master section
                </pages>
            </App>
        </Shell>
    </mvc:View>

    App.controller.js

    Nothing is to be written App.Controller.js file

    sap.ui.define([
        "sap/ui/core/mvc/Controller"
    ], function (Controller) {
        "use strict";
    
        return Controller.extend("admin.admin.controller.App", {
    
            onInit: function () {
    
            }
        });
    
    });

    Manifest.json

    1. Change the rootView to App

    "rootView": {
                "viewName": "admin.admin.view.App",
                "type": "XML",
                "async": true,
                "id": "app"
            },

    2. Update the Routing configuration

    "routing": {
                "config": {
                    "routerClass": "sap.m.routing.Router",
                    "viewType": "XML",
                    "async": true,
                    "viewPath": "admin.admin.view",
                    "controlId": "app",
                    "clearControlAggregation": false
                },
                "routes": [{
                    "name": "Login",
                    "pattern": "",
                    "target": [
                        "masterTarget",
                        "Login"
                    ]
                }, {
                    "name": "Dashboard",
                    "pattern": "Dashboard",
                    "target": [
                        "masterTarget",
                        "Dashboard"
                    ]
                }, {
                    "name": "Appointments",
                    "pattern": "Appointments",
                    "target": [
                        "masterTarget",
                        "Appointments"
                    ]
                }, {
                    "name": "Doctors",
                    "pattern": "Doctors",
                    "target": [
                        "masterTarget",
                        "Doctors"
                    ]
                }, {
                    "name": "Patient",
                    "pattern": "Patient",
                    "target": [
                        "masterTarget",
                        "Patient"
                    ]
                }, {
                    "name": "Subscription",
                    "pattern": "Subscription",
                    "target": [
                        "masterTarget",
                        "Subscription"
                    ]
                }, {
                    "name": "Symptoms",
                    "pattern": "Symptoms",
                    "target": [
                        "masterTarget",
                        "Symptoms"
                    ]
                }, {
                    "name": "Specialty",
                    "pattern": "Specialty",
                    "target": [
                        "masterTarget",
                        "Specialty"
                    ]
                }, {
                    "name": "Tests",
                    "pattern": "Tests",
                    "target": [
                        "masterTarget",
                        "Tests"
                    ]
                }, {
                    "name": "Support",
                    "pattern": "Support",
                    "target": [
                        "masterTarget",
                        "Support"
                    ]
                }],
                "targets": {
                    "masterTarget": {
                        "viewType": "XML",
                        "transition": "slide",
                        "controlAggregation": "masterPages",
                        "viewId": "idMaster",
                        "viewName": "Master",
                        "viewLevel": 1,
                        "controlId": "Splitapp"
                    },
                    "Login": {
                        "viewType": "XML",
                        "transition": "slide",
                        "controlAggregation": "detailPages",
                        "viewId": "Login",
                        "viewName": "Login",
                        "viewLevel": 1,
                        "controlId": "Splitapp"
                    },
                    "Dashboard": {
                        "viewType": "XML",
                        "transition": "slide",
                        "controlAggregation": "detailPages",
                        "viewId": "idDashboard",
                        "viewName": "Dashboard",
                        "viewLevel": 1,
                        "controlId": "Splitapp"
                    },
                    "Appointments": {
                        "viewType": "XML",
                        "transition": "slide",
                        "controlAggregation": "detailPages",
                        "viewId": "idAppointments",
                        "viewName": "Appointments",
                        "viewLevel": 1,
                        "controlId": "Splitapp"
                    },
                    "Doctors": {
                        "viewType": "XML",
                        "transition": "slide",
                        "controlAggregation": "detailPages",
                        "viewId": "idDoctors",
                        "viewName": "Doctors",
                        "viewLevel": 1,
                        "controlId": "Splitapp"
                    },
                    "Patient": {
                        "viewType": "XML",
                        "transition": "slide",
                        "controlAggregation": "detailPages",
                        "viewId": "idPatient",
                        "viewName": "Patient",
                        "viewLevel": 1,
                        "controlId": "Splitapp"
                    },
                    "Subscription": {
                        "viewType": "XML",
                        "transition": "slide",
                        "controlAggregation": "detailPages",
                        "viewId": "idSubscription",
                        "viewName": "Subscription",
                        "viewLevel": 1,
                        "controlId": "Splitapp"
                    },
                    "Symptoms": {
                        "viewType": "XML",
                        "transition": "slide",
                        "controlAggregation": "detailPages",
                        "viewId": "idSymptoms",
                        "viewName": "Symptoms",
                        "viewLevel": 1,
                        "controlId": "Splitapp"
                    },
                    "Specialty": {
                        "viewType": "XML",
                        "transition": "slide",
                        "controlAggregation": "detailPages",
                        "viewId": "idSpecialty",
                        "viewName": "Specialty",
                        "viewLevel": 1,
                        "controlId": "Splitapp"
                    },
                    "Tests": {
                        "viewType": "XML",
                        "transition": "slide",
                        "controlAggregation": "detailPages",
                        "viewId": "idTests",
                        "viewName": "Tests",
                        "viewLevel": 1,
                        "controlId": "Splitapp"
                    },
                    "Support": {
                        "viewType": "XML",
                        "transition": "slide",
                        "controlAggregation": "detailPages",
                        "viewId": "idSupport",
                        "viewName": "Support",
                        "viewLevel": 1,
                        "controlId": "Splitapp"
                    }
                }
            }

    As you can see we have multiple detail page, and a common thing among all is “masterTarget”. This is the target for Master Page, i.e. “The left pane where you can have multiple tabs to switch pages”.

    Master Page View:  Master.view.xml

    <mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"  xmlns:tnt="sap.tnt"
        controllerName="admin.admin.controller.Master" xmlns:html="http://www.w3.org/1999/xhtml">
        <Page id="master" title="{i18n>Actions}" backgroundDesign="List" class="sapUiStdPage">
            <!--All Master Pane tabs are maintained here-->
            <tnt:NavigationList id="navigationList" selectedKey="Tab_1" itemSelect="onListItemPress">
                <tnt:NavigationListItem text="Configuration" icon="sap-icon://overview-chart" key="Dashboard"></tnt:NavigationListItem>
                <tnt:NavigationListItem text="Appointments" icon="sap-icon://account" key="Appointments"></tnt:NavigationListItem>
                <tnt:NavigationListItem text="Doctors" icon="sap-icon://stethoscope" key="Doctors"></tnt:NavigationListItem>
                <tnt:NavigationListItem text="Patient" icon="sap-icon://wounds-doc" key="Patient"></tnt:NavigationListItem>
                <tnt:NavigationListItem text="Subscription" icon="sap-icon://collections-insight" key="Subscription"></tnt:NavigationListItem>
                <tnt:NavigationListItem text="Symptoms" icon="sap-icon://electrocardiogram" key="Symptoms"></tnt:NavigationListItem>
                <tnt:NavigationListItem text="Medical Specialty" icon="sap-icon://clinical-order" key="Specialty"></tnt:NavigationListItem>
                <tnt:NavigationListItem text="Tests" icon="sap-icon://clinical-tast-tracker" key="Tests"></tnt:NavigationListItem>
                <tnt:NavigationListItem text="Support" icon="sap-icon://headset" key="Support"></tnt:NavigationListItem>
                <!--<tnt:NavigationListItem text="Log Out" icon="sap-icon://log" key="LogOut"></tnt:NavigationListItem>-->
            </tnt:NavigationList>
            <footer>
                <OverflowToolbar>
                    <Text text="{i18n>appVersion}"/>
                    <ToolbarSpacer/>
                </OverflowToolbar>
            </footer>
        </Page>
    </mvc:View>

    Master Controller: Master.controller.js

    sap.ui.define([
        "sap/ui/core/mvc/Controller"
    ], function (Controller) {
        "use strict";
    
        return Controller.extend("admin.admin.controller.Master", {
    
            /**
             * Called when a controller is instantiated and its View controls (if available) are already created.
             * Can be used to modify the View before it is displayed, to bind event handlers and do other one-time initialization.
             * @memberOf Healthbridge-admin.Healthbridge-admin.view.Master
             */
            onInit: function () {
                // Get Router Info
                this.oRouter = this.getOwnerComponent().getRouter();
            },
            /**
             * onListItemPress is invoked on click from UI. 
             * Input: Key Maintained in Master View
             * Output: Navigation to the Master Page
             */
            onListItemPress: function (oEvent) {
                var that = this;
                sap.ui.core.BusyIndicator.show();
                // var sTimeOutErrorMsg = this.oBundle.getText("TimeOutError");
                var sError;
                var sToPageId = oEvent.getParameter("item").getKey();
                if (sToPageId) {
                    try {
                        that.oRouter.navTo(sToPageId);
                    } catch (err) {
                        if (err.statusCode === 401) {
                            // sError = sTimeOutErrorMsg;
                            window.location.reload(true);
                            sap.ui.core.BusyIndicator.hide();
                        } else {
                            sError = err.error;
                            sap.m.MessageBox.error(sError);
                            window.location.reload(true);
                            sap.ui.core.BusyIndicator.hide();
                        }
                        // window.location.href = '../logout';
                    }
                } else {
                    window.location.reload(true);
                    sap.ui.core.BusyIndicator.hide();
                }
            }
    
        });
    
    });

    Apart from above, you can simply create your pages and controllers and keep linking them in master page and manifest file.

    Changes in Detail Pages

    In Detail pages, you need to handle a few things:

    • Within On Init or Route Matched section, you need to unhide Master Section, in this use case it is hidden, as first page was Login, and we don’t want to show Master section. The code is as below:
      // By default it is set "HideMode" 
      this.getView().getParent().getParent().setMode("ShowHideMode");
      // This is to hide the Master Button over the master page invisible
      this.getView().getParent().getParent()._oShowMasterBtn.setVisible(false);

      In case, you directly go to Master Detail Section, just delete the mode from App.view.xml

    • You can hide and unhide Master tab/section on click of a button whose code is mentioned below
      We have written the code for button press “onExpandPress”:
      Button code: <Button icon=”sap-icon://full-screen” tooltip=”{i18n>Expand}” press=”onExpandPress”/>
      Controller Code:

      /**
               * onExpandPress is invoked from UI on press of button Expand. 
               * Input: current mode -- Full Screen or Pane Screen
               * Output: opposite mode -- Pane Screen or Full Screen
               */
      
              onExpandPress: function (oEvent) {
                  var navVisible = this.getView().getParent().getParent().getMode();
                  if (navVisible === "ShowHideMode") {
                      this.getView().getParent().getParent().setMode("HideMode");
                      oEvent.getSource().setIcon("sap-icon://exit-full-screen");
                  } else {
                      this.getView().getParent().getParent().setMode("ShowHideMode");
                      oEvent.getSource().setIcon("sap-icon://full-screen");
                  }
                  this.getView().getParent().getParent()._oShowMasterBtn.setVisible(false);
              },

       

  • Quantum materials

    Preface – This post is part of the Quantum Computing series.

    What are Quantum materials?

    Quantum materials are materials that exhibit unusual physical properties that are related to quantum-mechanical phenomena, such as superconductivity, magnetism, and topological insulators. Quantum materials are often characterized by their ability to conduct electricity with very low resistance (superconductors) or to exhibit extremely strong magnetic properties (magnetic materials).

    Quantum materials are of interest to scientists and engineers because they have the potential to enable the development of new technologies, such as quantum computers, energy-efficient electrical power transmission, and advanced sensors. Quantum materials are also important for understanding the fundamental properties of matter and energy at the atomic and subatomic scale.

    There are many different types of quantum materials, including superconductors, magnetic materials, topological insulators, and correlated electron materials. These materials exhibit a wide range of physical properties, and they are often studied using a variety of techniques, including spectroscopy, imaging, and scattering experiments.

    Quantum materials are an active area of research in materials science and condensed matter physics, and they continue to be a source of new and interesting discoveries.

  • Mathematical foundations for Quantum Computing

    Preface – This post is part of the Quantum Computing series.

    The mathematical foundations of quantum computing are based on the principles of quantum mechanics, which is a fundamental theory in physics that describes the behavior of matter and energy at the atomic and subatomic scale. Quantum mechanics is based on the principles of wave-particle duality and quantum uncertainty, and it provides a mathematical framework for understanding the properties of quantum systems.

    Some of the key mathematical concepts that are used in quantum computing include:

    1. Wave functions: In quantum mechanics, the wave function is a mathematical function that describes the probability of finding a particle or system at a given position and orientation. The wave function is represented by the Greek letter psi (Ψ), and it is a key component of the quantum mechanical description of a system.
    2. Operators: Operators are mathematical objects that act on functions to produce new functions. In quantum mechanics, operators are used to describe the physical quantities and properties of quantum systems, such as position, momentum, and energy.
    3. Matrix algebra: Matrix algebra is a branch of mathematics that deals with matrices, which are rectangular arrays of numbers. Matrix algebra is an important tool in quantum computing because it is used to represent quantum states and quantum operations.
    4. Linear algebra: Linear algebra is a branch of mathematics that deals with linear equations and vector spaces. Linear algebra is an important tool in quantum computing because it is used to describe the linear relationships between quantum states and quantum operations.
    5. Group theory: Group theory is a branch of mathematics that deals with symmetry and the properties of groups, which are sets of elements that can be combined using certain operations. Group theory is an important tool in quantum computing because it is used to classify and understand the symmet

    Here are a few more mathematical concepts that are used in quantum computing:

    1. Tensors: Tensors are mathematical objects that generalize the concept of a matrix to higher dimensions. Tensors are used in quantum computing to represent quantum states and quantum operations in a compact and efficient way.
    2. Eigenvalues and eigenvectors: In linear algebra, eigenvalues and eigenvectors are special types of scalars and vectors that are associated with linear transformations. Eigenvalues and eigenvectors are important in quantum computing because they are used to describe the properties of quantum states and quantum operations.
    3. Fock space: In quantum mechanics, Fock space is a mathematical structure that is used to describe the states of systems with a fixed number of particles, such as atoms and photons. Fock space is an important concept in quantum computing because it is used to represent the states of quantum systems with a fixed number of qubits.
    4. Unitary matrices: In linear algebra, a unitary matrix is a matrix that preserves the inner product of vectors. Unitary matrices are important in quantum computing because they are used to represent quantum operations that preserve the inner product of quantum states.
    5. Schrödinger equation: The Schrödinger equation is a fundamental equation in quantum mechanics that describes the time evolution of a quantum system. The Schrödinger equation is used to predict the behavior of quantum systems and to understand the properties of quantum states.
  • Power of Computation in Quantum Computing

    Preface – This post is part of the Quantum Computing series.

    Quantum computers have the potential to perform certain types of computations much faster than classical computers. This is because quantum computers are based on the principles of quantum mechanics, which allow them to perform certain types of operations in parallel and to take advantage of quantum-mechanical phenomena, such as superposition and entanglement, to perform operations on data.

    One of the key advantages of quantum computers is that they can perform certain types of operations exponentially faster than classical computers. For example, quantum computers can perform certain types of searches, such as unstructured searches, much faster than classical computers. Quantum computers can also perform certain types of mathematical operations, such as factorization, much faster than classical computers.

    Another advantage of quantum computers is that they have the potential to solve certain types of problems that are currently intractable using classical computers. These include problems that involve simulating complex quantum systems, such as atoms and molecules, and problems that involve optimizing complex systems, such as supply chains and logistics networks.

    It’s worth noting that quantum computers are not necessarily faster than classical computers for all types of computations. In fact, many common tasks, such as web browsing and word processing, can be performed more efficiently on classical computers. However, for certain types of problems, quantum computers have the potential to offer significant computational advantages over classical computers.

  • Introduction to the term Quantum

    Preface – This post is part of the Quantum Computing series.

    The term “quantum” refers to the smallest unit of a physical quantity that can exist. It is derived from the Latin word “quantus,” which means “how much.” In classical physics, quantities such as position, momentum, and energy are continuous, which means that they can take on any value within a given range. In contrast, in quantum mechanics, these quantities are quantized, which means that they can only take on certain discrete values.

    The concept of quantization is a fundamental principle of quantum mechanics, which is a theory in physics that describes the behavior of matter and energy at the atomic and subatomic scale. Quantum mechanics is based on the principles of wave-particle duality and quantum uncertainty, and it provides a mathematical framework for understanding the properties of quantum systems.

    Quantum mechanics has had a profound impact on our understanding of the fundamental nature of the universe and has led to the development of many important technologies, including lasers, transistors, and quantum computers. The term “quantum” is used in a variety of contexts to describe phenomena and technologies that are related to quantum mechanics, including quantum computing, quantum information, and quantum cryptography.

  • Important terms in Quantum Mechanics

    Preface – This post is part of the Quantum Computing series.

    Here are some important terms in quantum mechanics:

    1. Wave function: In quantum mechanics, the wave function is a mathematical function that describes the probability of finding a particle or system at a given position and orientation. The wave function is represented by the Greek letter psi (Ψ), and it is a key component of the quantum mechanical description of a system.
    2. Quantum state: A quantum state is the complete set of information that is needed to describe a quantum system at a given time. It is determined by the wave function of the system and the values of its physical parameters, such as position, momentum, and energy.
    3. Uncertainty principle: The uncertainty principle is a fundamental principle in quantum mechanics that states that it is impossible to simultaneously know the precise position and momentum of a quantum particle with complete accuracy. This is because the more accurately the position of a particle is known, the less accurately its momentum can be known, and vice versa.
    4. Quantum superposition: Quantum superposition is a phenomenon in which a quantum system can exist in multiple states simultaneously. This is a consequence of the wave-particle duality of quantum systems, which can exhibit both wave-like and particle-like properties.
    5. Quantum entanglement: Quantum entanglement is a phenomenon in which two or more quantum particles become “linked” such that the state of one particle is correlated with the state of the other. This means that the state of one particle can be affected by the state of the other, even if they are separated by large distances.
    6. Quantum mechanics: Quantum mechanics is a fundamental theory in physics that describes the behavior of matter and energy at the atomic and subatomic scale. It is based on the principles of wave-particle duality and quantum uncertainty, and it provides a mathematical framework for understanding the properties of quantum systems.
    7. Quantum computers: Quantum computers are computer systems that use quantum-mechanical phenomena, such as superposition and entanglement, to perform operations on data. Quantum computers are designed to be able to perform certain types of calculations much faster than classical computers, and they have the potential to solve problems that are currently intractable using classical computers.
    8. Quantum algorithms: Quantum algorithms are algorithms that are designed to be run on quantum computers. Quantum algorithms are typically more efficient than classical algorithms for certain types of problems, and they are an important area of research in quantum computing.
    9. Quantum error correction: Quantum error correction is a technique used to protect quantum information from errors and noise that can occur during the processing and transmission of quantum data. Quantum error correction is an important area of research in quantum computing because it is necessary to ensure the reliability and accuracy of quantum computers.
    10. Quantum teleportation: Quantum teleportation is a phenomenon in which the state of a quantum particle is transmitted from one location to another without physically moving the particle. Quantum teleportation is achieved using the principles of quantum entanglement and quantum superposition, and it has important applications in quantum computing and communication.
    11. Quantum key distribution: Quantum key distribution is a technique used to securely transmit a key (a secret piece of information) over a quantum channel. Quantum key distribution is based on the principles of quantum mechanics and makes use of the inherent security of quantum states to protect the key from being intercepted or compromised.
    12. Quantum gates: Quantum gates are basic building blocks of quantum circuits that are used to perform operations on quantum data. Quantum gates are similar to classical logic gates in that they take one or more input qubits and produce one or more output qubits. However, unlike classical logic gates, quantum gates can operate on multiple qubits simultaneously and can perform operations that are not possible using classical gates.
    13. Quantum circuits: Quantum circuits are networks of quantum gates that are used to perform operations on quantum data. Quantum circuits are an important part of quantum computing because they provide a way to design and implement quantum algorithms and protocols.
    14. Quantum annealing: Quantum annealing is a optimization technique that is used to find the global minimum of a function. It is based on the principles of quantum mechanics and makes use of quantum superposition and quantum tunneling to explore the space of possible solutions to a problem. Quantum annealing is an important area of research in quantum computing and has potential applications in a variety of fields, including machine learning and finance.
    15. Quantum encryption: Quantum encryption is a technique used to secure communication using the principles of quantum mechanics. Quantum encryption makes use of the inherent security of quantum states to protect the confidentiality of transmitted information.
    16. Quantum simulator: A quantum simulator is a device that is used to simulate the behavior of quantum systems. Quantum simulators are important tools for studying the properties of quantum systems and for developing and testing quantum algorithms and protocols. Quantum simulators can be implemented using a variety of physical systems, including ions, atoms, and photons.
  • Angular momentum in Quantum Mechanics

    Preface – This post is part of the Quantum Computing series.

    In quantum mechanics, angular momentum is a physical property that describes the rotational motion of a particle or system. It is closely related to the concept of angular momentum in classical mechanics, but it has some important differences due to the principles of quantum mechanics.

    In classical mechanics, angular momentum is defined as the product of an object’s mass, its velocity, and its distance from a fixed point (known as the moment of inertia). Angular momentum is a vector quantity, which means it has both a magnitude and a direction. In quantum mechanics, angular momentum is also a vector quantity, but it is quantized, which means that it can only take on certain discrete values.

    The quantization of angular momentum is a consequence of the wave-particle duality of quantum systems. Quantum systems can exhibit both wave-like and particle-like properties, and the angular momentum of a quantum system is determined by its wave function, which describes the probability of finding the system at a given position and orientation.

    The angular momentum of a quantum system is described by its angular momentum operator, which is a mathematical operator that acts on the system’s wave function to determine its angular momentum. The angular momentum operator is closely related to the position and momentum operators, which describe the position and momentum of a quantum system.

    Angular momentum is an important concept in quantum mechanics because it plays a role in many phenomena, including the structure of atoms and molecules, the behavior of particles in magnetic fields, and the quantum states of particles with spin. It is also an important tool for understanding the symmetries of quantum systems, and it is used to classify the quantum states of particles and systems.

  • Basics of Photons

    Preface – This post is part of the Quantum Computing series.

    What is a Photon?

    A photon is a fundamental particle of light. It is the smallest unit of light that can exist, and it is the carrier of the electromagnetic force, which is one of the fundamental forces of nature.

    Photons have no mass, and they travel at the speed of light (about 299,792,458 meters per second in a vacuum). They are often described as particles of light because they can be absorbed and emitted by matter, but they also exhibit wave-like properties, such as interference and diffraction.

    Photons are produced when an atom or molecule changes energy states, for example when an electron in an atom jumps from a higher energy level to a lower energy level. This process releases a photon with energy equal to the difference between the two energy levels.

    Photons can also be produced when charged particles, such as electrons, are accelerated or decelerated. This process, known as bremsstrahlung, produces photons with a continuous spectrum of energies.

    Photons play a central role in many phenomena in physics and chemistry, including the emission and absorption of light, the operation of lasers and LEDS, and the interactions between atoms and molecules. They are also important in many technological applications, such as telecommunications, solar power, and imaging.

    Photons in Quantum Computing

    In quantum computing, photons are used to encode and transmit quantum information. Quantum information is a type of information that is stored and processed using the principles of quantum mechanics, which is a fundamental theory in physics that describes the behavior of matter and energy at the atomic and subatomic scale.

    One of the key features of quantum information is that it can be stored and processed using quantum states, which are the fundamental units of quantum information. Quantum states can be represented using a variety of different physical systems, including photons.

    In a quantum computing system that uses photons to encode quantum information, the state of a photon (also known as its polarization) is used to represent the quantum state. For example, a photon with vertical polarization might represent a “1” bit of quantum information, while a photon with horizontal polarization might represent a “0” bit.

    Photons are used in quantum computing because they have several properties that make them well-suited for storing and transmitting quantum information. Photons are extremely small and lightweight, which makes them easy to manipulate and control. They also interact weakly with their environment, which makes them relatively resistant to noise and errors. Finally, photons can be easily generated, detected, and transmitted over long distances, which makes them useful for building large-scale quantum computing systems.

    There are several different approaches to using photons in quantum computing, including using single photons to represent quantum bits (qubits) of information, using entangled photons to perform quantum teleportation, and using arrays of photonics elements to build scalable quantum computing architectures.

  • OpenQASM

    Preface – This post is part of the Quantum Computing series.

    What in OpenQASM?

    OpenQASM (Open Quantum Assembly Language) is a quantum assembly language developed by IBM that is used to describe quantum circuits and algorithms. It is designed to be a low-level language that allows researchers and developers to specify quantum operations in a precise and unambiguous way, and it is intended to be used as a basis for higher-level quantum programming languages and tools.

    OpenQASM is similar to classical assembly languages, which are used to describe operations that are executed by classical computers. Like classical assembly languages, OpenQASM consists of a set of instructions that can be used to perform specific operations on quantum data. However, unlike classical assembly languages, OpenQASM is specifically designed to work with quantum systems, and it includes instructions that are specific to quantum computers, such as quantum gates and measurement operations.

    OpenQASM programs can be executed on quantum hardware or quantum simulators, and they can be compiled from higher-level quantum programming languages using OpenQASM compilers. OpenQASM is designed to be a flexible and extensible language, and it is intended to support a wide range of quantum computing applications and architectures.

    Where to code OpenQASM?

    There are several ways you can code OpenQASM programs:

    1. IBM Qiskit: IBM Qiskit is an open-source quantum computing framework that includes support for OpenQASM. You can use Qiskit to write, execute, and debug OpenQASM programs on real quantum computers or on quantum simulators. Qiskit includes a number of tools and libraries that make it easy to work with OpenQASM, including an interactive quantum compiler and a Jupyter notebook integration.
    2. Online quantum computing platforms: There are several online platforms that allow you to write and run OpenQASM programs on real quantum computers or on quantum simulators. Examples include the IBM Quantum Experience and Rigetti Forest. These platforms typically provide a web-based interface for writing and executing OpenQASM programs, as well as tools for visualizing and analyzing the results.
    3. Local development environment: You can also set up a local development environment for writing and running OpenQASM programs. To do this, you will need to install a quantum computing framework that supports OpenQASM, such as Qiskit or PyQuil, and configure your environment to work with a quantum hardware or simulator. You can then use a text editor or integrated development environment (IDE) to write and debug your OpenQASM programs.

    It’s worth noting that OpenQASM is a low-level quantum assembly language, and it may not be the most intuitive or user-friendly way to write quantum programs. If you are new to quantum computing, you may want to consider using a higher-level quantum programming language, such as Q# or PyQuil, which provide a more abstract and higher-level interface for working with quantum systems.

    Industries involved in OpenQASM?

    Quantum computing has the potential to impact a wide range of industries, and OpenQASM is one of the tools that is being used to develop quantum computing applications. Some of the industries that are actively exploring the use of quantum computing include:

    1. Financial services: Quantum computers could potentially be used to perform complex financial simulations and risk assessments faster and more accurately than classical computers.
    2. Healthcare: Quantum computers could be used to analyze and interpret large amounts of medical data, such as genomic sequences, to help identify patterns and correlations that could be used to improve patient care.
    3. Manufacturing: Quantum computers could be used to optimize complex manufacturing processes, such as supply chain management and logistics.
    4. Energy: Quantum computers could be used to optimize the design and operation of energy systems, such as solar panel arrays and power grids.
    5. Defense: Quantum computers could be used to perform complex simulations and analysis to support military operations, such as logistics and supply chain management.

    These are just a few examples of the potential applications of quantum computing, and it is likely that other industries will also explore the use of quantum computers as the technology continues to mature.