solutionmodel MarkupException issue with form inheritance

Questions, tips and tricks and techniques for scripting in Servoy

solutionmodel MarkupException issue with form inheritance

Postby udiluca » Mon Mar 09, 2015 12:53 pm

Hello,

I'm getting an Internal Error anytime I start debuging the web-client for the second time. The first time, it works fine, then I need to restart developer so that it works, or i get this message in the Servoy Admin Page.

org.apache.wicket.markup.MarkupException: Unable to find component with id 'sv__0DB075E1_D7CB_4716_A5D5_296E426F23D9' in [MarkupContainer [Component id = sv__8AC5EBCA_E25C_437C_9BE0_55199F16CC4F]]. This means that you declared wicket:id=sv__0DB075E1_D7CB_4716_A5D5_296E426F23D9 in your markup, but that you either did not add the component to your page at all, or that the hierarchy does not match.

followed by the markup.

Here's what I'm doing. I'm building an app with ( for the moment ) a 4 deep module hierarchy : main_app/navigation_module/transaction_module/ui_module
One form on the ui_module, "ui_big_menu", which acts as the application main menu is customized based on user privileges. Then involving form inheritance, this form is show in the main app in a "app_big_menu", which extend from "navi_big_menu", extending from "tra_big_menu" and finally extending from the "ui_big_menu" I intend to customize on startup.

If i set the opening form for testing purpose to be the "ui_big_menu", everything works as expected. Anytime I set one of the forms that inherits from the "ui_big_menu", it will work the first time and then throw the "Internal Error" and the log above. I need to restart developper to make it works once.

It sure has to do with the Solution Model and inheritance has everything works if I comment this part of the onSolutionOpen method.

If anyone has a clue for me, I'd be gratefull.

Here's my code, it seems very basic to me : _aSections is an array of the available sections as Strings, _obj is an object holding several properties for each sections.
I'm cloning existing components on the form that I'm using as references for new ones, then I'm removing thos references at the end of the function.

Code: Select all
function frm_buildApplicationBigMenu(_aSections, _obj){
   
   /**@type{JSForm}*/
   var jsform;
   /**@type{String}*/
   var sectionName;
   /**@type{JSComponent}*/
   var jsSeparatorLabel;
   /**@type{JSComponent}*/
   var newjsSeparatorLabel;
   /**@type{JSComponent}*/
   var jsTitle;
   /**@type{JSLabel}*/
   var newjsTitle;
   /**@type{JSButton}*/
   var jsGoToButton;
   /**@type{JSButton}*/
   var newjsGoToButton;

   jsform= solutionModel.getForm(_frm_base_application_menu_big);
   jsGoToButton= jsform.getComponent(_baseGoToButton);
   jsSeparatorLabel= jsform.getLabel(_baseSeparatorLabel);
   jsTitle= jsform.getComponent(_baseTitle);

   for (var index = 0; index < _aSections.length; index++) {
      sectionName= _aSections[index];
      newjsTitle=solutionModel.cloneComponent(_titleLabelName+(index+1),jsTitle);
      newjsTitle.y= (jsTitle.height * index) + jsTitle.y + (2*index);
      newjsTitle.text= _obj[sectionName].title;

      newjsGoToButton=solutionModel.cloneComponent(_gotoButtonName+(index+1),jsGoToButton);
      newjsGoToButton.y= newjsTitle.y;

      newjsSeparatorLabel=solutionModel.cloneComponent(_separatorLabelName+(index+1),jsSeparatorLabel);
      newjsSeparatorLabel.y= newjsTitle.y + newjsTitle.height + 1;
      newjsSeparatorLabel.formIndex=1;
      newjsTitle.formIndex= 2;
      newjsGoToButton.formIndex=3;
      
   }

   jsform.removeComponent(jsSeparatorLabel.name);
   jsform.removeComponent(jsTitle.name);
   jsform.removeComponent(jsGoToButton.name);
   
   forms[jsform.name].controller.recreateUI();
   
}


Thanks

Ugo
udiluca
 
Posts: 23
Joined: Wed Apr 10, 2013 7:25 pm

Re: solutionmodel MarkupException issue with form inheritanc

Postby udiluca » Mon Mar 09, 2015 2:58 pm

Ok,

So as far as I can see, it's all about something I don't fully understand.

Attached is a small test solution with only 2 modules and 2 forms.

What i'm trying to acccomplish is customize the super_form and display the child form, this is done on startup in the onOpenSolution.
I'm thus just modifying one label and one button in the parent form, cloning them, modifying text and y position, then deleting the original button and label on this form. Calling controller.recreateUI() or not doesn't change anything, I tried deleting the forms history but nothing more.
I'm still getting the same problem referenced in my first post, that is that it works the first time I debug it in a webclient, but then it throw an Internal Error anytime I want to debug it again. Same thing happen on the server though, I have to restart the server.

Here's the small error log :
Code: Select all
org.apache.wicket.markup.MarkupException: Unable to find component with id 'sv__D5F25A3E_4BD4_4AD9_B817_357A9B9564DE_wrapper' in [MarkupContainer [Component id = sv__9E7C152F_5103_43E4_B628_336EF210EB77]]. This means that you declared wicket:id=sv__D5F25A3E_4BD4_4AD9_B817_357A9B9564DE_wrapper in your markup, but that you either did not add the component to your page at all, or that the hierarchy does not match.
    [markup = Markup[solution:sm_app, fullpath:/servoy-webclient/templates/default/sm_app/app_base.html]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <!-- Servoy webclient page Copyright 2015 Servoy -->
    <html>
    <head>
    <title>app_base - Servoy</title>
    <servoy:head>
    </servoy:head>
    </head>
    <body id='servoy_page'>
    <form id='servoy_dataform'>
    <servoy:panel>
    <div servoy:id="servoywebform" id="form_app_base" class="servoywebform">
    <div id="sfw_form_app_base" style="position: absolute; height: 0px; right: 0px; left: 0px;"></div><div id="sfh_form_app_base" style="position: absolute; bottom: 0px; top: 0px; width: 0px;"></div><div servoy:id="View">
    <div servoy:id="default_navigator" style="overflow: auto;position: absolute;left: 0px;width: 70px;top: 0px;bottom: 0px;"></div><div servoy:id="sv__9E7C152F_5103_43E4_B628_336EF210EB77" id="sv__9E7C152F_5103_43E4_B628_336EF210EB77" class="formpart">
    <div servoy:id="sv__D5F25A3E_4BD4_4AD9_B817_357A9B9564DE_wrapper" id="sv__D5F25A3E_4BD4_4AD9_B817_357A9B9564DE_wrapper"><button type="submit" style="white-space: nowrap;" servoy:id="sv__D5F25A3E_4BD4_4AD9_B817_357A9B9564DE" class="button"></button></div>
    <div style="white-space: nowrap;" servoy:id="sv__4702BA5E_C1B3_420E_ABBA_BA6011163979" class="label">MyNewLabel</div>
    </div>
    </div>
    </div>
    </servoy:panel>
    </form>
    </body>
    </html>


What I did that worked is cloning the super form, then changing the extend form, one by one from the parent form to the last child form.
this is not part of the sample solution attached but here's what work in my case :
Code: Select all
   //newjsform is the clone from the original super form we just altered
   forms[newjsform.name].controller.recreateUI();
   
   //childjsform is the first child in the hierarchy for the super_form
   childjsform= solutionModel.getForm('tra_menu_big');
   childjsform.extendsForm= newjsform;
   forms[childjsform.name].controller.recreateUI();
   
   //childjsform2 is the second child in the hierarchy for the super_form
   var childjsform2= solutionModel.getForm('navi_menu_big');
   childjsform2.extendsForm= childjsform;
   forms[childjsform2.name].controller.recreateUI();
   
   //childjsform3 is the third and last child in the hierarchy for the super_form
   var childjsform3= solutionModel.getForm('cs_menu_big');
   childjsform3.extendsForm= childjsform2;
   forms[childjsform3.name].controller.recreateUI();



So is this the way to go or what am I missing exactly ? Thanks

Ugo

sm_app.servoy
(5.44 KiB) Downloaded 75 times
udiluca
 
Posts: 23
Joined: Wed Apr 10, 2013 7:25 pm


Return to Methods

Who is online

Users browsing this forum: No registered users and 1 guest

cron