-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Using Tapestry 2.2

I have a component (Misko's TreeComponent actually) that I am attempting to 
add a parameter to. Not to hard methinks. Well, perhaps I should think again! 
(no fault of Misko's might I add)

The problem is that the listener I am adding is NEVER set.
The tree component is used like this:

    <component id="sourceProperties" type="Tree:Tree">
        <binding name="tree" expression='propertiesModel'/>
        <binding name="treeEventListener" 
expression='components.propertiesEditor'/>
    </component>

components.propertiesEditor implements the listener interface, the idea being 
that as I click and use the tree, the other thing recieves the events and 
"does stuff".  The fault is that no listener instance is EVER set in the tree 
itself.

I've used a very basic implementation for the tree property, as follows:

    <parameter
        name="treeEventListener"
        java-type="net.sf.tapestry.contrib.tree.ITreeEvents"
        direction="in"
        required="no">
        <description>
            <![CDATA[   open/click and close events can be sent to this 
listener   ]]>
        </description>
    </parameter>

With java code as follows:

        /**
         * Returns the treeEventsListener.
         * @return ITreeEvents
         */
        public ITreeEvents getTreeEventsListener() {
                if (log.isDebugEnabled()) {
                        log.debug("Trying to return the tree events listener. The 
member var is : " 
+ treeEventsListener);
                }

                if (treeEventsListener == null) {
                        IBinding binding = getBinding("treeEventsListener");

                        if (log.isDebugEnabled()) {
                                log.debug("Member var is null, binding is " + binding);
                        }

                        if (binding != null) {
                                if(log.isDebugEnabled()) {
                                        log.debug("The object in the binding is " + 
binding.getObject());
                                }
                                
                                return (ITreeEvents) binding.getObject();
                        }
                }
                return treeEventsListener;
        }

        /**
         * Sets the treeEventsListener.
         * @param treeEventsListener The treeEventsListener to set
         */
        public void setTreeEventsListener(ITreeEvents treeEventsListener) {
                if (log.isDebugEnabled()) {
                        log.debug("Setting the tree events listener to " + 
treeEventsListener);
                }
                this.treeEventsListener = treeEventsListener;
        }


The output when I perform an action on the tree is:

    [exec] 22:16:59,498 DEBUG [net.sf.tapestry.contrib.tree.TreeComponent] 
Trying to return the tree events listener. The member var is : null
     [exec] 22:16:59,499 DEBUG [net.sf.tapestry.contrib.tree.TreeComponent] 
Member var is null, binding is null
     [exec] 22:16:59,499 DEBUG [net.sf.tapestry.contrib.tree.TreeComponent] 
Not calling tree event listener because it is not set

Looks like there's NO binding at all.
WEEEIRD.

What have I done wrong?
I've been staring at this for quite a while now. Time for bed!

- -- 
Regards,
Neil Clayton

(PS: If you see strange text you don't understand underneath my email, don't 
worry - it's just my PGP signature)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+F12+LXcfQF3yrNoRAiTtAJ0a+nn++4h1zPJdwCQzzTH1Q6bSZgCfVnGl
huQ3qCYrsfwLEkClqGwKm4c=
=TNx9
-----END PGP SIGNATURE-----



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer

Reply via email to