webdynpro context

Upload: bandistechnology

Post on 05-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/31/2019 WEBDYNPRO Context

    1/4

    CONTEXT :

    Context is used to store UI r e lated d ata. Context is avai lable at ever y contr ol ler of

    a com ponent .

    An a t t r ibute is a context ent i ty tha t ha s cer ta in pr oper t ies and can be d i r ect ly

    created in the root node CONTEXT, or as a ch i ld for another node . Usua l ly , a node

    is used to group m ore a t t r ibutes tha t be long together .

    A context n ode can have a t t r ib utes or can h o ld o ther nodes, but a context

    a t t r ib ute cannot have o ther a t t r ib utes or nodes . The r oot node CONTEXT is

    autom at ica l ly crea ted w hen th e cont ro l le r is in i t ia l i zed and a l l the n odes and

    at t r ib utes w e created ar e ch i ldr en o f th is root node .

  • 7/31/2019 WEBDYNPRO Context

    2/4

    GETT ER & SETT ER M ETHOD S :

    Nod e is used t o s tored s ing le or m ul t ip l e data o f UI elem ents .

    Nod e is alw ays associated w it h i nt erface IF_W D_CONTEXT_NODE

    At tr ibu tes of a node is associated w it h in ter face IF_W D_CONTEXT_ELEMENT .

    Steps to read or se t any sing le or m ul t ip le a t t r ibu te va lue re la ted to context node:

    1 . Th rou gh th e re fer ence of ro ot cont ext nod e ( i .e . W D_CONTEXT ) ca l l the ins tancem ethod GET_CHILD_NODE to get cor r espon din g ch i ld nod e re ference

    (IF_WD_CONTEXT_NODE ).

    Pass the requ i r ed nod e nam e to th i s m ethod w h ich in t u rn s re tu r ns the requ i r ed

    nod e re ference.

    DA TA : LR_NOD E TYPE REF TO IF_W D_CONT EXT_NOD E.

    LR_NODE = W D_CONT EXT->GET_CHI LD_NODE ( W DT CX_ ).

  • 7/31/2019 WEBDYNPRO Context

    3/4

    2 . Get the element r efer ence ( I F_W D_CONTEXT_ELEMENT ) th r ough t he chi l d nod er efer ence by u sing instance m etho d GET_ELEMENT .

    DAT A : LR_ELE TYPE REF TO IF_W D_CONT EXT_ELEM ENT .

    LR_ELE = LR_NODE->GET_ELEM ENT ( ).

    3 . Using th i s e lem ent r e fer ence w e can read or set any sing le or m ul t i p le at t r ibu teva lues o f context n ode.

    a. To r ead any sing le a t t r ibut e o f cont ext node use th e m ethodGET_ATTRIBUTE

    D A T A :

    TYPE W D_TH IS->ELEMENT_-ATT R NAM E.

    LR_ELE->GET_ATTRIBUTE(

    EXPORTI NG NAM E = ATT RIBUTE NAM E

    IM PORT IN G VALUE =

    ) .

    b . To r ead m u l t i p le a t t r i bu tes o f a con tex t nod e use the methodGET_STATIC_ATTRIBUTES

    DAT A T YPE REF TO W D_T HI S->ELEM ENT_.

    LR_ELE->GET_STATIC_ATTRIBUTES (

    IM PORT ING ST AT IC_AT T RIBUT ES = ) .

    c. To set any va lue to sing le a t t r ibut e o f context node use th e m ethodSET_ATTRIBUTE

    D A T A :

    TYPE W D_TH IS->ELEMENT_-ATT R NAM E.

    LR_ELE->SET_ATTRIBUTE(

    EXPORTI NG NAM E = ATT RIBUTE NAM E

    VALU E =

    ) .

    d . To set m u l t i p l e at t r i bu tes o f a con tex t nod e use the m ethodSET_STATIC_ATTRIBUTES

    DAT A T YPE REF TO W D_T HI S->ELEM ENT_.

    LR_ELE->SET_STATIC_ATTRIBUTES (

    EXPORTI NG ST AT IC_AT T RIBUT ES = ) .

  • 7/31/2019 WEBDYNPRO Context

    4/4