[Xerte] Re: Location in the tree?

Julian Tenney Julian.Tenney at nottingham.ac.uk
Thu Feb 14 14:21:50 GMT 2013


This is already in there which almost does it:

XMLNode.prototype.findParentByType = function(type){
                var targetIcon = this;
                while (targetIcon.nodeName != type && targetIcon.nodeName != 'LO') {
                                targetIcon = targetIcon.parentNode;
                }
                return targetIcon.nodeName != 'LO' ? targetIcon : -1;
}

But if you push the indexes into an array en-route you'll get a way of figuring out where you were. But if you call it from a button response, it will recurse up from there, so you need to keep building the path as the user navigates, and then when you press the button, store the last built list.

ICON.prototype.navigate has some related methods that might be handy: findPath() and findNode()?

INTERFACE.prototype.navigate = function(id) {
                //we need to find the clip - put it on this.targetNode
                this.targetNode = "";
                this.findNode(this.XMLElement, id);
                //find a path through frameworks - put it on this.navPath
                this.findPath(this.targetNode);
                //navigate in correct sequence
                for (var i = this.navPath.length-1; i>=0; i--) {
                                //we need to check we are at the right fw - there may be preceeding icons to exit
                                //before the correct fw is rendered - and therefore can be navigated. FWs
                                //must be rendered before they can be navigated
                                for (var j = 0; j<this.navPath[i].fwIndex; j++) {
                                                var type = this.navPath[i].fwNode.parentNode.childNodes[j].nodeName;
                                                if (type == 'FW' || type == 'INT' || type == 'DEC' || type == 'SND') {
                                                                this.navPath[i].fwNode.parentNode.childNodes[j].clip().exit();
                                                }
                                }
                                if (this.navPath[i].pageIndex > 0){
                                                this.navPath[i].fwNode.clip().gotoPage(this.navPath[i].pageIndex);
                                }
                }
};

From: xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett
Sent: 14 February 2013 14:11
To: Xerte list
Subject: [Xerte] Re: Location in the tree?

150 bespoke modules.

>You'd need to know where to recurse up from

Can I just ask for my parent and my index then rinse and repeat up to root?


________________________________
From: Julian.Tenney at nottingham.ac.uk<mailto:Julian.Tenney at nottingham.ac.uk>
To: xerte at lists.nottingham.ac.uk<mailto:xerte at lists.nottingham.ac.uk>
Date: Thu, 14 Feb 2013 13:51:35 +0000
Subject: [Xerte] Re: Location in the tree?
You'd need to know where to recurse up from. Possibly you could do something in the navigation system so you know where you are? Is it a predictable structure, or is it more 'bespoke'?

From: xerte-bounces at lists.nottingham.ac.uk<mailto:xerte-bounces at lists.nottingham.ac.uk> [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett
Sent: 14 February 2013 13:45
To: Xerte list
Subject: [Xerte] Re: Location in the tree?


I guess I would have to recurse up the xml to trap for FW.

________________________________
From: Julian.Tenney at nottingham.ac.uk<mailto:Julian.Tenney at nottingham.ac.uk>
To: xerte at lists.nottingham.ac.uk<mailto:xerte at lists.nottingham.ac.uk>
Date: Thu, 14 Feb 2013 13:28:25 +0000
Subject: [Xerte] Re: Location in the tree?
Yes. Can you do something with fw  indexes?

From: xerte-bounces at lists.nottingham.ac.uk<mailto:xerte-bounces at lists.nottingham.ac.uk> [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett
Sent: 14 February 2013 13:06
To: Xerte list
Subject: [Xerte] Re: Location in the tree?


>icon is the calling icon
<LO>
 <INT> //Interface
   <ENT_FR>
     <SCR> //function here
     <INT>
     <RES> //perpetual debug button
       <SCR> //do the debug stuff

Won't the calling icon always be the debug <SCR>?








________________________________
From: Julian.Tenney at nottingham.ac.uk<mailto:Julian.Tenney at nottingham.ac.uk>
To: xerte at lists.nottingham.ac.uk<mailto:xerte at lists.nottingham.ac.uk>
Date: Thu, 14 Feb 2013 12:55:07 +0000
Subject: [Xerte] Re: Location in the tree?
Hmm. Not sure. If you call a function icon is the calling icon, that might help, otherwise fw.currentPage won't have changed, but it depends on your se structure how easy that will be

From: xerte-bounces at lists.nottingham.ac.uk<mailto:xerte-bounces at lists.nottingham.ac.uk> [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett
Sent: 14 February 2013 12:17
To: Xerte list
Subject: [Xerte] Re: Location in the tree?


Give proofreaders a way to hit a button which logs where they are and pops a text input so they can add some notes.


________________________________
From: Julian.Tenney at nottingham.ac.uk<mailto:Julian.Tenney at nottingham.ac.uk>
To: xerte at lists.nottingham.ac.uk<mailto:xerte at lists.nottingham.ac.uk>
Date: Thu, 14 Feb 2013 11:58:44 +0000
Subject: [Xerte] Re: Location in the tree?
Don't think you can. What do you want to do - might need to think differently.

From: xerte-bounces at lists.nottingham.ac.uk<mailto:xerte-bounces at lists.nottingham.ac.uk> [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett
Sent: 14 February 2013 11:29
To: Xerte list
Subject: [Xerte] Location in the tree?


For debugging I'm hanging a button in an Interface entry frame.
How can I tell where I am in the tree when it is invoked?




_______________________________________________ Xerte mailing list Xerte at lists.nottingham.ac.uk<mailto:Xerte at lists.nottingham.ac.uk> http://lists.nottingham.ac.uk/mailman/listinfo/xerte




_______________________________________________ Xerte mailing list Xerte at lists.nottingham.ac.uk<mailto:Xerte at lists.nottingham.ac.uk> http://lists.nottingham.ac.uk/mailman/listinfo/xerte




_______________________________________________ Xerte mailing list Xerte at lists.nottingham.ac.uk<mailto:Xerte at lists.nottingham.ac.uk> http://lists.nottingham.ac.uk/mailman/listinfo/xerte




_______________________________________________ Xerte mailing list Xerte at lists.nottingham.ac.uk<mailto:Xerte at lists.nottingham.ac.uk> http://lists.nottingham.ac.uk/mailman/listinfo/xerte
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20130214/71d5b1cf/attachment-0001.html>


More information about the Xerte mailing list