As I said the other day, your "config" node feeds your module's <class> as a javabean. It needs to know what classes to use where, and for collections, all you need is an "add" method:
* public Collection getLogos() {}
* public void addLogo(Logo l) { this.logos.add(l); }

hth,

-g

On Oct 7, 2008, at 12:16 PM, Matteo Pelucco wrote:

Hi all!
I need a quick help to better understand how to read module config when I want to have structured configuration data like

[everything is under myModule / config]
- logos
 - logo1
   - path = "/logos/logo1.jpg"
   - displayName = "logo1"
   - width = "400"
   - height = "300"
 - logo2
   - path = "/logos/logo2.jpg"
   - displayName = "logo2"
   - width = "200"
   - height = "150"
 - logo3
   - path = "/logos/logo3.jpg"
   - displayName = "logo3"
   - width = "400"
   - height = "300"

I'm going to build a new control called "imagePicker".
The idea is to let the authors to select images from a predefined set.

Image set is defined using configuration.

Having a look into source code, I've found how to use custom module config, and it seems that there are 3 major use cases:

+++++++++++++++++++++++++++++++++++++++++++++++
A) Simple config
There is a simple config (String siteLiveUrl = "http:// www.google.com")

Configuration:
        [Node Data] siteLiveUrl (Type = String)
Java: get module instance and call getter method.

+++++++++++++++++++++++++++++++++++++++++++++++
B) Collection config
A collection of string, e.g. Collection jsFiles with 3 children.


Configuration
        [Content Node] jsFiles
          - [Node Data] file1 = "mootools.js"
          - [Node Data] file2 = "prototype.js"
          - [Node Data] ...
Java: using an iterator I can retrive stored values.

+++++++++++++++++++++++++++++++++++++++++++++++
C) Structured config
Nested Structured This is not so clear...

        [Content Node] grandfather
          - [Content Node] father
              - [Content Node] child
                - [Node Data] property1 = "a"
                - [Node Data] property2 = "b"

Can you quick explain me? Thanks so much..

Matteo


----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------


----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------

Reply via email to