java - Find all elements based on Root Parent and drawing an HTML -


my code follows:

class globalinfo {      // multiple properties here }  class regionalinfo extends globalinfo {     // multiple properties here     globalinfo parent; }  class bankinfo extends globalinfo {     // multiple properties here     globalinfo parent; } 

there multiple bankinfo in 1 regionalinfo. , there multiple regionalinfo parents inside bankinfo object.

for e.g.,

bankinfo == bank of america  regionalinfo == dallas // 1st parent  regionalinfo == texas // dallas's parent  regionalinfo == midwest // texas's parent , final parent. 

per above example, immediate parent of bankinfo object points dallas, , it's parent points texas , it's parent point midwest.

in cases, there maybe 1 or 2 parents

for e.g.,

bankinfo == university credit union  regionalinfo == houston 

so e.g., tree view root parent like,

<midwest>    <independent bank of midwest/>    <midland bank of america/>    <texas>       <bank of america>       <chase bank>       <wells fargo>       <austin>          <supereme national bank>          <master chanse bank>          <austin east>             <national bank of austin>             <federal bank>          </austin east>       </austin>     </texas>    <arizona></arizona>    <kansas>       <federal credit union>       <kansas state bank>       <wichita>          <state bank of kansas>          <wichita credit union>       </wichita>    </kansas>    <missouri>       <bank of st louis>    </missouri>    <kentucky></kentucky>    <iowa></iowa> </midwest> 

the places objects of regionalinfo , bank's objects of bankinfo.

the challenge here is, see there's possibility of more regionalinfo objects inside 1 regionalinfo object.

i want come optimized logic go through children root parent , draw html using ol , li elements.

so sample html tags below.

<li>             <label for="folder1">midwest</label> <input type="checkbox" id="folder1" />              <ol>                 <li class="file"><a href="#">independent bank of midwest</a></li>                 <li class="file"><a href="#">midland bank of america</a></li>                 <li>                     <label for="subfolder1">texas</label> <input type="checkbox" id="subfolder1" />                      <ol>                         <li class="file"><a href="">bank of america</a></li>                         <li class="file"><a href="">chase bank</a></li>                         <li class="file"><a href="">wells fargo</a></li>                         <li>                             <label for="subsubfolder1">austin</label> <input type="checkbox" id="subsubfolder1" />                              <ol>                                 <li class="file"><a href="">supereme national bank</a></li>                                 <li class="file"><a href="">master chanse bank</a></li>                                 <li>                                     <label for="subsubfolder2">austin east</label> <input type="checkbox" id="subsubfolder2" />                                      <ol>                                         <li class="file"><a href="">national bank of austin</a></li>                                         <li class="file"><a href="">federal bank</a></li>                                     </ol>                                 </li>                             </ol>                         </li>                     </ol>                 </li>             </ol>         </li> 

the above html incomplete. hope gives idea.

i struggling come better logic iteration through each child element avoiding multiple loops.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -