Sei sulla pagina 1di 2

07/10/2015

iWiDiWhatareNamedandIndexedChildreninOAF?

WhatareNamedandIndexedChildreninOAF?

TalksAbout:IndexedandnamedchildreninOAF.
Everyougotcuriousaboutquestionslike"Whatisnamedchildren?Whatisindexedchildren?"
InshaAllahinthisarticleImaytrytoexplain,whatthesetermsmeantoanOAFrameoworkDeveloper.
Iguessthisistheonlyarticleoninternetwhichmaytellyouaboutmuchused,butmuchlessunderstoodconceptofindexedandnamedchildren
inOAF.Thisisoneofthepurposeofthiswebsite...clearingtheconcepts.
YouknowthatanOAFpageismadeupofXMLtags/elements.Theseelementsareusedtodefinecomponentswhicharevisibletouser(like
button,textbox)aswellascomponentswhicharenotvisibletotheuser.
Layoutcomponentsarethefamousnonvisiblecomponentswhichareusedtocontrolpositionetc.ofthevisiblecomponents.
AnOAFpageishierarchicalstructureofparentandchildrelationships.Usually,Layoutelementsaretheparentswhosechildrenarevisiblechild
elements.
Thedifferenceofhowachildelementisarrangedinalayoutelement,makesthatchildanamedchildoranindexedchild.
Inthishierarchy,thereisanotherelementcalled"roleelement"whichdecideshowthechildrenarearrangedinthatlayout.
Iftheroleelementis"contents",childrenarearrangedinasequentialorder.Thus,thesechildrenarecalledindexedchildrenof
thatlayoutelement.
Ifsomespecificelement(notcontents)isusedas"roleelement",topredefinepositionsofchildrenelements,thanthesechildren
arecallednamedchildrenofthatlayoutelement.
Namedchildrengetsspecialtreatment(placedatspecialplace),thustreatedasVIP.
Indexedchildrenarecommonman,gointhequeue,onebyone.
Nowletstakeaviewofstandard"HelloWorldPG.xml"toseewhatarethenamedandindexedchildrenavailablethere.

Green:LayoutElements.
Red:RoleElements.
Yellow:Childelements.
IndexedChildren:
Eachdirectchildof"contents"elementisindexedchildofthedirectparentlayout.
IDsofsomeindexedchildreninthispage:
PageLayoutRN
MainRN
HelloName
Go
IDsofsomenamedchildren
corporateBranding
productBranding
Anoteaboutfindingchildrenincontroller.
webBean.findChildRecursive:tofindoutanychildren(bothnamedandindexed)
findIndexedChildRecursive:tofindspecificindexchild
webBean.getNamedChild:togetaspecificnamedchild.

Nowifyouhaveconfusionabouthowtolocatespecificbeanincontroller,justlookatthexmlofthepageanduseappropriatemethod.
SeeOAFjavadocumentationformoremethodstolocatespecificchildinyourpagebeanhierarchy.
Hereissomethingtoseethatalayoutcancontainonlysingle"contents"roleelement(whichinturncancontainmanyindexedchildren).
However,alayoutmaycontainmultiplenamedroletoholddifferentnamechildren.Butagain,eachnamedrolecancontainonlysinglenamed 1/2
data:text/htmlcharset=utf8,%3Ch1%20class%3D%22itempagetitle%22%20style%3D%22fontsize%3A%20inherit%3B%20lineheight%3A%2012px%3B%2

07/10/2015

iWiDiWhatareNamedandIndexedChildreninOAF?

However,alayoutmaycontainmultiplenamedroletoholddifferentnamechildren.Butagain,eachnamedrolecancontainonlysinglenamed
child.
That'sit.
Niceee...

data:text/htmlcharset=utf8,%3Ch1%20class%3D%22itempagetitle%22%20style%3D%22fontsize%3A%20inherit%3B%20lineheight%3A%2012px%3B%2

2/2

Potrebbero piacerti anche