Topic
40 replies Latest Post - ‏2013-03-01T17:22:52Z by CarlD
XWHK_Joe_DeLutis
XWHK_Joe_DeLutis
80 Posts
ACCEPTED ANSWER

Pinned topic Model Container

‏2013-01-04T21:11:09Z |
Went out to http://www-10.lotus.com/ldd/pfwiki.nsf/dx/07292008112740AMWEBL5U.htm (Community Articles > Web Experience Factory > Samples and Techniques for Web Experience Factory > Techniques for building a controller model using Model Container and events) to read up on using Model Containers for performance. I downloaded the package (code sample) and do not understand why when I click on the Order ID link in the View One Page that it only works on the first press of the linked Order ID. Whenever I go to another row after the first pass it appears the Assignment!Variables/SelectedItemID=${Arguments/orderID} does not get loaded with the current Order ID row value. Can someone help me understand why this is happening?
Updated on 2013-03-01T17:22:52Z at 2013-03-01T17:22:52Z by CarlD
  • XWHK_Joe_DeLutis
    XWHK_Joe_DeLutis
    80 Posts
    ACCEPTED ANSWER

    Re: Model Container

    ‏2013-01-07T17:37:38Z  in response to XWHK_Joe_DeLutis
    Can someone explain why the RowLoopVar does not change in this sample (see URL from previous post)?
    • SystemAdmin
      SystemAdmin
      9029 Posts
      ACCEPTED ANSWER

      Re: Model Container

      ‏2013-01-07T18:33:39Z  in response to XWHK_Joe_DeLutis
      The row loop var works fine for me running on a standalone J2EE container (not Portal). Do you have errors in the log file? Do you have the Tutorials and Samples feature set enabled for the project?

      However, I had to disable WEF's Partial Page Refresh by adding a Theme builder in Main.model and setting the two inputs under the Partial-Page Refresh section to No. I don't know off the top of my head how to alter the app so partial page refresh would work.

      --Sam
      The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
      • SystemAdmin
        SystemAdmin
        9029 Posts
        ACCEPTED ANSWER

        Re: Model Container

        ‏2013-01-07T18:42:52Z  in response to SystemAdmin
        Again, the loop var is fine for me. Let us know if you see errors.

        I figured out the partial page refresh issue: The WEF code that implements partial page refreshing gets added to the page twice, once in view1.model and again in view2.model. This causes a conflict. In one of the models -- say, view2.model -- add a Theme builder and disable Partial Page Refreshing.

        Then it will work fine with partial page refreshing.

        --Sam
        The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
        • XWHK_Joe_DeLutis
          XWHK_Joe_DeLutis
          80 Posts
          ACCEPTED ANSWER

          Re: Model Container

          ‏2013-01-07T19:16:47Z  in response to SystemAdmin
          Can you please post your models? I still have not been able to get this to work. It seems that for efficiency we should implement Model Containers, so I need to understand this sample in order to apply it to a real Portal Application that I will need to develop.
          • XWHK_Joe_DeLutis
            XWHK_Joe_DeLutis
            80 Posts
            ACCEPTED ANSWER

            Re: Model Container

            ‏2013-01-07T19:34:52Z  in response to XWHK_Joe_DeLutis
            No errors in the logs. I have the Tutorials/Samples on. When the Main Page comes up I see 2 views. When I select a hyperlink (Order ID) from view 1 I go to the details page and it displays the proper Order ID. When I return to the Main Page and select another order id on View 1 to go to details page, the original Order ID that I first selected continually appears. Also, when I select an order id from view 2 nothing happens. The "update' form does not display.
            • SystemAdmin
              SystemAdmin
              9029 Posts
              ACCEPTED ANSWER

              Re: Model Container

              ‏2013-01-07T20:34:43Z  in response to XWHK_Joe_DeLutis
              I see what you mean, and I can reproduce it. (I misread your earlier post)

              Unfortunately, the sample application has a blatant bug; the original author did it wrong. The Loop Var is working correctly -- the order id of the current row is passed in the event, which can easily be seen when you SystemOut it -- but the Detail1 and Detail2 model don't know to re-execute the service using the new id.

              Give me a day to fix it.

              --Sam
              The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
              • XWHK_Joe_DeLutis
                XWHK_Joe_DeLutis
                80 Posts
                ACCEPTED ANSWER

                Re: Model Container

                ‏2013-01-07T21:19:18Z  in response to SystemAdmin
                Thanks...I'll keep a watch out for whatever you can provide to me.
                • SystemAdmin
                  SystemAdmin
                  9029 Posts
                  ACCEPTED ANSWER

                  Re: Model Container

                  ‏2013-01-10T20:21:32Z  in response to XWHK_Joe_DeLutis
                  I apologize for the delay.

                  I quickly put together a more simplistic sample and article.

                  See http://www-10.lotus.com/ldd/pfwiki.nsf/dx/Componentizing_your_UI_with_the_Model_Container_and_Event_Builders

                  Let me know if you have questions.

                  --Sam
                  The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
                  • XWHK_Joe_DeLutis
                    XWHK_Joe_DeLutis
                    80 Posts
                    ACCEPTED ANSWER

                    Re: Model Container

                    ‏2013-01-10T20:56:19Z  in response to SystemAdmin
                    Sam,

                    Example is helpful but I am looking for something a little more detailed. I have an application that starts with a Main Menu with a few radio buttons on it. Based on what I select I go to a "leg" of the application that allows me to view all orders (view and form). That Orders view and form has a button on it that allows me to add a new order (open an input form). I can also select an existing order from the list to update it. The other options off the Main Menu are to view reports on orders. Can you show me how to add a "main menu" that calls out to the Main.model in your example and then allows your Main.Model to return to a "main menu"? My goal is to build a parent-child model framework where the parent is a main menu and all other functions are children from the main menu.

                    Thanks,
                    JD
                    • SystemAdmin
                      SystemAdmin
                      9029 Posts
                      ACCEPTED ANSWER

                      Re: Model Container

                      ‏2013-01-10T22:06:22Z  in response to XWHK_Joe_DeLutis
                      Common pattern, ive done something similar before for customer. Not by computer at moment, but I'll see what I can do. Basically same concept: model container and events.

                      --SamThe postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
                      • SystemAdmin
                        SystemAdmin
                        9029 Posts
                        ACCEPTED ANSWER

                        Re: Model Container

                        ‏2013-01-11T21:19:26Z  in response to SystemAdmin
                        See this article and sample app I just put together. http://www-10.lotus.com/ldd/pfwiki.nsf/dx/Building_a_Componentizedcom_Menu-driven_Application_with_Model_Container

                        It uses WEF's Page Navigation builder and the Model Container builder together to achieve the functionality you're looking for.

                        Hope this helps.

                        --Sam
                        The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
                        • SystemAdmin
                          SystemAdmin
                          9029 Posts
                          ACCEPTED ANSWER

                          Re: Model Container

                          ‏2013-01-15T15:43:51Z  in response to SystemAdmin
                          JD,
                          Feedback?
                          Thanks,
                          Sam
                          • XWHK_Joe_DeLutis
                            XWHK_Joe_DeLutis
                            80 Posts
                            ACCEPTED ANSWER

                            Re: Model Container

                            ‏2013-01-15T16:10:16Z  in response to SystemAdmin
                            Sam,

                            Still going through things. Have started to apply the principles to a real prototype. So far the example has been very helpful. I take it I could use a page with radio buttons in the Main Model as opposed to a page with page navigation builder, correct? I reply back with more info when I get through more of my prototype, but so far what you posted has been really helpful.

                            JD
                            • XWHK_Joe_DeLutis
                              XWHK_Joe_DeLutis
                              80 Posts
                              ACCEPTED ANSWER

                              Re: Model Container

                              ‏2013-01-15T18:18:18Z  in response to XWHK_Joe_DeLutis
                              One final question for you Sam.... if I wanted the to be able to pass keys/values to and from the models being "swapped" in and out, could I do this using "shared variables"? I am assuming I could do so.
                              • SystemAdmin
                                SystemAdmin
                                9029 Posts
                                ACCEPTED ANSWER

                                Re: Model Container

                                ‏2013-01-15T18:25:04Z  in response to XWHK_Joe_DeLutis
                                Shared Variable would work, but you can also pass values using the Event Declaration and Event Handler builders. In Event Declaration, you can define what data you want to pass to the handlers. When you fire the event, Designer will prompt you for the data to pass in the event. In the Event Declaration builder, when you select an event to handle, it will recognize the data and you can do what you want with it. Eventing seems like the preferred way here.
                                --Sam
                                The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
                                • XWHK_Joe_DeLutis
                                  XWHK_Joe_DeLutis
                                  80 Posts
                                  ACCEPTED ANSWER

                                  Re: Model Container

                                  ‏2013-01-16T16:48:26Z  in response to SystemAdmin
                                  Sam,

                                  I have 3 models swapping in and out. When I am in "model 1" on a view form and press a button that "fires" an event being handled in "model 2" nothing happens. I have an event handler in model 2 that is to use a passed value to read the database. Model 2 never gets fired. Can you help? I need to pass data between the models being swapped in and out of the container. Do I need to fire the vent and swap model 2 into the container for this to occur?

                                  JD
                                  • SystemAdmin
                                    SystemAdmin
                                    9029 Posts
                                    ACCEPTED ANSWER

                                    Re: Model Container

                                    ‏2013-01-16T18:46:45Z  in response to XWHK_Joe_DeLutis
                                    Sounds like Model 2 is not loaded. Swapping in model 2 into container is one way to load it.

                                    --Sam
                                    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
                                    • XWHK_Joe_DeLutis
                                      XWHK_Joe_DeLutis
                                      80 Posts
                                      ACCEPTED ANSWER

                                      Re: Model Container

                                      ‏2013-01-16T18:49:43Z  in response to SystemAdmin
                                      Not sure how to swap the model in when the button in model 1 is pressed. Would it help if I posted the models for you to look at and give me advise?
                                  • CarlD
                                    CarlD
                                    46 Posts
                                    ACCEPTED ANSWER

                                    Re: Model Container

                                    ‏2013-01-16T19:31:38Z  in response to XWHK_Joe_DeLutis
                                    You may want to also check out a similar article I wrote on this topic a while ago. This sure seems like a great design pattern for WEF.

                                    http://www-10.lotus.com/ldd/pfwiki.nsf/dx/Leveraging_the_Model_Container_Builder

                                    There is a download link at the bottom of the article with a runnable model.

                                    Hope that helps.
                                    Carl.


                                    IBM Certified Solution Developer - WebSphere Portlet Factory 7.0
                                    My blog http://dsixe-wpf.blogspot.com
                                    • XWHK_Joe_DeLutis
                                      XWHK_Joe_DeLutis
                                      80 Posts
                                      ACCEPTED ANSWER

                                      Re: Model Container

                                      ‏2013-01-17T21:55:05Z  in response to CarlD
                                      Carl,
                                      One question...how do you pass multiple parameters when using the ModelInitializationData?
                                      JD
                                      • CarlD
                                        CarlD
                                        46 Posts
                                        ACCEPTED ANSWER

                                        Re: Model Container

                                        ‏2013-01-17T22:19:27Z  in response to XWHK_Joe_DeLutis
                                        Since ModelInitializationData is a single parameter, multiple values would have to be packaged as xml before being sent in the event, and unpackaged when received in the child model.

                                        Carl.


                                        IBM Certified Solution Developer - WebSphere Portlet Factory 7.0
                                        My blog http://dsixe-wpf.blogspot.com
                                        • XWHK_Joe_DeLutis
                                          XWHK_Joe_DeLutis
                                          80 Posts
                                          ACCEPTED ANSWER

                                          Re: Model Container

                                          ‏2013-01-21T18:00:17Z  in response to CarlD
                                          Carl,

                                          Love the example but how do you handle database errors? For instance, I have a model loaded into the container that inserts data into Oracle. I created an event handler to address database errors but I cannot redisplay the current page with an error message. Can you supply database error handling suggestions/examples for me?

                                          JD
                                          • XWHK_Joe_DeLutis
                                            XWHK_Joe_DeLutis
                                            80 Posts
                                            ACCEPTED ANSWER

                                            Re: Model Container

                                            ‏2013-01-21T18:42:56Z  in response to XWHK_Joe_DeLutis
                                            DISREGARD last message. I think I have created a solution!
                                            • CarlD
                                              CarlD
                                              46 Posts
                                              ACCEPTED ANSWER

                                              Re: Model Container

                                              ‏2013-01-22T17:21:26Z  in response to XWHK_Joe_DeLutis
                                              Joe, hopefully my article provided some insight for you. I would appreciate if you could write feedback comments or rate it.

                                              Thanks. Carl.


                                              IBM Certified Solution Developer - WebSphere Portlet Factory 7.0
                                              My blog http://dsixe-wpf.blogspot.com
                                              • XWHK_Joe_DeLutis
                                                XWHK_Joe_DeLutis
                                                80 Posts
                                                ACCEPTED ANSWER

                                                Re: Model Container

                                                ‏2013-01-22T17:43:05Z  in response to CarlD
                                                Just finished adding comments and rating. Thanks for the help...excellent!
                                                • XWHK_Joe_DeLutis
                                                  XWHK_Joe_DeLutis
                                                  80 Posts
                                                  ACCEPTED ANSWER

                                                  Re: Model Container

                                                  ‏2013-02-05T19:47:29Z  in response to XWHK_Joe_DeLutis
                                                  Carl...using your example I created an excellent application. I am having one issues. When I fire a model that inserts data to an Oracle database I use an ErrorHandler to catch the insert error but I can't get the EventHandler to work to handle all other "unhandled errors". The EventHandler seems to just be ignored. I need to be able to handle all unexpected errors. Any suggestions?
                                                  • CarlD
                                                    CarlD
                                                    46 Posts
                                                    ACCEPTED ANSWER

                                                    Re: Model Container

                                                    ‏2013-02-05T21:24:28Z  in response to XWHK_Joe_DeLutis
                                                    Joe - how are your inputs defined for the error handler builder? Do you have more than one error handler builder in your model?


                                                    IBM Certified Solution Developer - WebSphere Portlet Factory 7.0
                                                    My blog http://dsixe-wpf.blogspot.com
                                                    • XWHK_Joe_DeLutis
                                                      XWHK_Joe_DeLutis
                                                      80 Posts
                                                      ACCEPTED ANSWER

                                                      Re: Model Container

                                                      ‏2013-02-05T21:39:00Z  in response to CarlD
                                                      Carl... I had one ErrorHandler to catch the duplicate insert and then I had one System:OnUnHandledError to catch all other errors in the model. The System:OnUnHandledError never seems to fire. I want to catch duplicate insert attempts and then let my System:OnUnHandledError catch any "unexpected errors" such as DB or servers down or thread connection issues....
                                                      • CarlD
                                                        CarlD
                                                        46 Posts
                                                        ACCEPTED ANSWER

                                                        Re: Model Container

                                                        ‏2013-02-06T15:59:19Z  in response to XWHK_Joe_DeLutis
                                                        Joe - I threw together a quick prototype to replicate the issue you described and it does behave as expected. The error handler builder traps the exception defined in its "exception class" input, and an event handler builder with System:OnUnHandledError defined in its "event name" input correctly traps all other exceptions.

                                                        I did notice that the model container builder has an input named "model to load on error" which leads me to believe that events don't percolate up from the contained models into the model container, so I wouldn't put the event handler builder in there.

                                                        Hope that helps. Carl.


                                                        IBM Certified Solution Developer - WebSphere Portlet Factory 7.0
                                                        My blog http://dsixe-wpf.blogspot.com
                                                        • XWHK_Joe_DeLutis
                                                          XWHK_Joe_DeLutis
                                                          80 Posts
                                                          ACCEPTED ANSWER

                                                          Re: Model Container

                                                          ‏2013-02-06T16:27:08Z  in response to CarlD
                                                          Carl... no luck. In the current model that was loaded into the model container I want to handle an insert to the database one way and then catch all other errors. When I use an ErrorHandler to handle the insert it works but any other errors are not detected by the Sysem:UnHandledErrors EventHandler. I got tired of the fight so I just coded a select count to prevent duplicate adds and used an ErrorHandler to catch all errors. I used the select count as part of my editing routing and when count > 0 I display my own error message on the input form. That way the ErrorHandler catches all other errors in the model and displays an error message on my Menu (most logical place for me to return to on a severe error). I have no idea why the EventHandler is not "activating".
                                                          • XWHK_Joe_DeLutis
                                                            XWHK_Joe_DeLutis
                                                            80 Posts
                                                            ACCEPTED ANSWER

                                                            Re: Model Container

                                                            ‏2013-02-26T21:17:15Z  in response to XWHK_Joe_DeLutis
                                                            Carl,

                                                            I ma having a real issue when I double click my buttons using the model containers. I continually receive a message

                                                            An error has occurred.
                                                            The error message returned was: "Error in method _pageDispatcher. The Specified action CustInt_BackBtnProcessing was not found.".

                                                            I press the browser back button and the proper page displays. The actions are present and work fine if I remain patient and don't click the button twice. Is there a way around this issue?
                                                            • CarlD
                                                              CarlD
                                                              46 Posts
                                                              ACCEPTED ANSWER

                                                              Re: Model Container

                                                              ‏2013-02-26T22:20:39Z  in response to XWHK_Joe_DeLutis
                                                              Does this only happen when running inside the container, or is it also happening when running the model standalone?


                                                              IBM Certified Solution Developer - WebSphere Portlet Factory 7.0
                                                              My blog http://dsixe-wpf.blogspot.com
                                                              • XWHK_Joe_DeLutis
                                                                XWHK_Joe_DeLutis
                                                                80 Posts
                                                                ACCEPTED ANSWER

                                                                Re: Model Container

                                                                ‏2013-02-27T14:07:03Z  in response to CarlD
                                                                Only happens when using the model container. I press a button that fires an event to read the database and open a new page. There is a delay and if I press the button multiple times I get the error described in my previous post. When I have one big model with all the functionality in it I do not experience the issue. I'd prefer to use the model container approach. Is there any way to avoid this? Is there any way to disable the button after it is pressed and then invoke the action list that reads the database and displays the new page?
                                                                • XWHK_Joe_DeLutis
                                                                  XWHK_Joe_DeLutis
                                                                  80 Posts
                                                                  ACCEPTED ANSWER

                                                                  Re: Model Container

                                                                  ‏2013-02-27T17:08:02Z  in response to XWHK_Joe_DeLutis
                                                                  I have been able to get around the issue by using the HTML Event Handler but am wondering if there is a better technique. To prevent the problem I have 2 HTML Event Handlers attached to my submit button. One is associated with the "onClick" and fires an event that opens a new model in the container, reads the database and displays a result set. The other HTML Event Handler is associated with the "onDblClick" and it executes a script that disables the button. I am not crazy about this but it works. I'd hate to have to attach 2 HTML Event Handlers to most of my buttons to prevent the error.
                                                                  • CarlD
                                                                    CarlD
                                                                    46 Posts
                                                                    ACCEPTED ANSWER

                                                                    Re: Model Container

                                                                    ‏2013-02-27T17:55:41Z  in response to XWHK_Joe_DeLutis
                                                                    I'm glad you found a workaround, but you're right, that isn't a long term solution. I will give it a look later today when I have a few minutes.


                                                                    IBM Certified Solution Developer - WebSphere Portlet Factory 7.0
                                                                    My blog http://dsixe-wpf.blogspot.com
                                                                    • XWHK_Joe_DeLutis
                                                                      XWHK_Joe_DeLutis
                                                                      80 Posts
                                                                      ACCEPTED ANSWER

                                                                      Re: Model Container

                                                                      ‏2013-02-28T20:57:04Z  in response to CarlD
                                                                      Problem still exists if I click the button, wait a second or two and then click the button again. Is there a way to disable a button from an action list or can I execute a script from an action list to disable the button?
                                                                      • CarlD
                                                                        CarlD
                                                                        46 Posts
                                                                        ACCEPTED ANSWER

                                                                        Re: Model Container

                                                                        ‏2013-02-28T22:46:24Z  in response to XWHK_Joe_DeLutis
                                                                        I tried to replicate on my side, changed the button click to 'submit form and invoke action' instead of 'link to action', but seems to work as expected.

                                                                        Can you replicate the problem in a standalone model and email it to me?
                                                                        IBM Certified Solution Developer - WebSphere Portlet Factory 7.0
                                                                        My blog http://dsixe-wpf.blogspot.com
                                                                        • XWHK_Joe_DeLutis
                                                                          XWHK_Joe_DeLutis
                                                                          80 Posts
                                                                          ACCEPTED ANSWER

                                                                          Re: Model Container

                                                                          ‏2013-03-01T15:25:37Z  in response to CarlD
                                                                          Carl,

                                                                          I can't replicate the problem in a standalone model. Is there a direct email address I can send a zip file to as I don't want to post a zip file of our work?

                                                                          JD
                            • SystemAdmin
                              SystemAdmin
                              9029 Posts
                              ACCEPTED ANSWER

                              Re: Model Container

                              ‏2013-01-15T19:05:47Z  in response to XWHK_Joe_DeLutis
                              And to answer your question about having radio buttons instead: It comes out of the box with several examples of Page Navigation templates; my example used the Multi-Line Navigation List. The Page Navigation builder was intentionally designed to so that you can create your own "template" for creating the Navigation Menu. I just created my own template to use with Page Navigation using the html fragment below and got it to display radio buttons instead. When you click a radio button, the corresponding application loads, just like with the original sample.

                              The Page Navigation builder uses Data Layout builder under the covers. Thus, if you want to create your own template like I've done, then take a look at the builder help for Data Layout builder. It describes the location where you put your template so that you can select it at design time in the Page Navigation or Data Layout builder, the WEF-specific tags (such as data-repeat-wrapper, data-target, etc) that page automation uses to creating the repeating elements in your menu, and the "meta" element at the top of the template.

                              Note that I'm dubious as to whether the choice of radio buttons is prudent, considering all the great UI styling you can do these days. I'd recommend having a good UX or Front End developer create a navigation ui for you, then turn it in to a Page Navigation/Data Layout template as described.

                              
                              <meta data-template-id=
                              "NavigationList" data-template-type=
                              "navigation" data-template-bundle-name=
                              "com.bowstreet.builders.webapp.package" data-template-name-id=
                              "DataLayoutNavigationListName" data-template-description-id=
                              "DataLayoutNavigationListDescription" data-template-name=
                              "Navigation List" data-template-description=
                              "This template allows you to generate a simple navigation list." data-stylesheets=
                              "/factory/data_layout_templates/navigation_list.css,/factory/data_layout_templates/blank.css" />   <div data-repeat-wrapper=
                              "default"> <div data-repeat-wrapper=
                              "Item"> <input type=
                              "radio" name=
                              "group1" value=
                              "test" /> <label for=
                              "group1"><span data-target=
                              "name"></span> </label> <br/> </div> </div>
                              


                              --Sam
                              The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.