Sign in

E-mail *, (xx@domain.com)
Password *

Register | Forgot password

Blogs

  • Bram de Kruijff
  • Ivo Ladage
  • Mark van Cuijk
  • Martin van Mierloo
  • Martijn van Berkum
  • Michel Teunissen
  • Patrick Atoon

Recent blogs

RSS - Blogs
March 9, 2010
State of OSGi in the Java world
March 4, 2010
Reach more people with Google Translate
March 3, 2010
Get My Advice
February 26, 2010
What? Where!?!
February 11, 2010
Split it!

All Blogs...


Scope, que?!

March 17, 2008

Ever noticed how you can use something for times on end without ever realizing what it is that you do?


I recently noticed that I never really had come to terms with the magical tag "scope" in presentation descriptor XML files. I mean, I have been using them by example (read: copy & paste) and was living happily ever after.

Then, one day, it suddenly struck me! I had learned the Purpose of Meaning of "scope".

Now all that remains is to spread this knowledge... What better place to do that than this blog?

Let us take a look at your typical presentation descriptor file "patricksPage.xml" that goes with "patricksPage.jsp":

<presentation>
    <name>Patrick's Page</name>
    <display-name>Patrick's Page</display-name>
    <scope>Page</scope>
</presentation>

Some things to know about this descriptor file:

  • The "name" has to be unique among all descriptor files!
  • The "display-name" is just a pretty print name to use in selection menus. It does not have to be unique, but it will make your life significantly easier if it resembles the "name" quite a bit.
  • The "scope" determines where your presentation will appear in GX WebManager.

To expand on the last item, this scope "Page" tells GX WebManager that the presentation should be selectable in places where page presentations are shown. The most obvious place being "Format > Presentation > Presentations".




But also, for example, under "File > Properties > Design...".




Or "Configure > Web Initiative configuration... > General".




If I had set the scope to "ListElement" instead, something silly would have happened:



Clearly, GX WebManager takes its hints of where to use presentations from the scope. It is safe to say that all things shown in HTML have presentations connected to them, and therefore have a scope. Under "Format > Presentation > Presentations" you will find a lengthy list of scopes that GX WebManager detected in all descriptor files.


Scope PagePart

There is one special scope: "PagePart". These presentations are so special that they have their own dedicated tab under "Format > Presentation > Page parts".



Page parts are special in that their sole purpose in life is to be called from JSP using the "<wm:pagePart>" tag. One could also turn that around, saying: if it is not defined in GX WebManager as a page part, it cannot be called from JSP using "<wm:pagePart>". The "Identifier" string has to match the given label in JSP exactly. The page part definition acts as a kind of glue between the label in JSP and a presentation known to GX WebManager. So, putting

 

<wm:pagePart label="Left Navigation" />

in your JSP will call GX WebManager and it will match that label "Left Navigation" to the presentation "Left Navigation" as selected in the previous screenshot. When examining the "Left Navigation" presentation in detail, you can see that "/WEB-INF/project/nl.gx.product.wmpcommunityeditionstyle/pagepart/leftnavigation.jsp" is used for rendering.



So, to recap:
  • There are plenty of scopes. Check "Format > Presentation > Presentations" for a list.
  • PageParts are special. Give them love by creating a page part under "Format > Presentation > Page parts" and in return you will be able to call them using "<wm:pagePart>".
  • If this was all over your head: use copy & paste and you will live happily ever after.

Later!

Greetings,

Patrick

About the Author

Return to all blogs

 

Patrick Atoon

Patrick Atoon has gained nuff respect as one of the most experienced web architects in the GX Webmanager community or even the global hip hop community for that matter.

Read all Patricks blog entries

Other blog entries:

February 26, 2010
What? Where!?!
September 3, 2009
Do the Right Thing
June 18, 2009
wm:link secrets
March 2, 2009
Server side represent! (Part 2)
February 4, 2009
Server side represent!
January 15, 2009
Making cache
December 9, 2008
Like A Version
August 19, 2008
Stop making sense
August 4, 2008
Namaste!
July 7, 2008
Japanese encore (日本のアンコール)


Share:

del.icio.us
digg
Technorati
Slashdot
Reddit
YahooMyWeb
NewsVine
ekudos
© 2010 GX creative online development B.V.

Disclaimer

This website (GXdeveloperweb.com) may discuss or contain opinions, (sample) coding, software or other information that does not include GX official interfaces, instructions or guidelines and therefore is not supported by GX. Changes made based on this information are not supported.  GX will not be held liable for any damages caused by using or misusing the information, software, instructions, code or methods suggested on this website, and anyone using these methods does so at his/her own risk. GX offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this website, including any liability resulting from incompatibility between the content of this website and the materials and services offered by GX. By using this website you will not hold, or seek to hold, GX responsible or liable with respect to the content of this website.