Hi Patricia,

I was planing to implement a tree view. So here is how I see it :
 - I would use a personnal namespace, let say "tree"
 - I would create my structure in my svg file as, for example
    <tree:element id="myTree" x="200" y="300">
       <text x="0" y="0">The text of the parent</text>
       <rect x="0" y="50" width="500" height="20">
       <tree:element>
           <text x="0" y="0">The text of the child1</text>
           <rect x="0" y="50" width="500" height="20">
       </tree:element>
       <tree:element>
           <text x="0" y="0">The text of the child2</text>
           <rect x="0" y="50" width="500" height="20">
           <tree:element>
               <text x="0" y="0">The text of the underchild1</text>
               <rect x="0" y="50" width="500" height="20">
           </tree:element>
       </tree:element>
   </tree:element>
- at the onload event of  my svg, I would run a function "initTree()" 
converting this structure in standard SVG element, with events and 
personnal attributes as
    <g id="myText" tree:index="0" transform="translate(200,300)" 
tree:width="550" tree:height="100">
         <rect x="-10" y="-10" fill="blue" height="10" width="10" 
onclick="showhidechild(evt)"/>
         <text x="0" y="0">The text of the parent</text>
         <rect x="0" y="50" width="500" height="20"/>
         <g tree:index="1" transform="translate(250,350)" 
tree:width="550" tree:height="100">
             <rect x="-10" y="-10" fill="blue" height="10" width="10" 
onclick="showhidechild(evt)"/>
             <text x="0" y="0">The text of the child1</text>
             <rect x="0" y="50" width="500" height="20"/>
          </g>
          <g tree:index="1" transform="translate(250,400)" 
tree:width="550" tree:height="100">
             <rect x="-10" y="-10" fill="blue" height="10" width="10" 
onclick="showhidechild(evt)"/>
             <text x="0" y="0">The text of the child2</text>
             <rect x="0" y="50" width="500" height="20"/>
                <g tree:index="2" transform="translate(300,450)" 
tree:width="550" tree:height="100">
                         <rect x="-10" y="-10" fill="blue" height="10" 
width="10" onclick="showhidechild(evt)"/>
                         <text x="0" y="0">The text of the 
underchild1</text>
                         <rect x="0" y="50" width="500" height="20"/>
                  </g>
          </g>

tree:index represent the number of  tabulation, ie the level in 
hierarchy of an element.
tree:width is the width of the bounding box of an element with its childs
tree:height if the height of the bounding bos of an element with its childs.

Those two values are used by the function showhidechild to calculate the 
new translate of any nextsibling element when you show one element.
For example, say you have the folowing structure:
    1    shown
       2    shown
          3    unshown
          4    shown
       5    shown
          6    shown
          7    shown
    8   shown
       9 shown
          10   shonw

and you want to show 3. You will have to translate 4, 5 and 8, ie the 
nextsibling element of 3, 2 and 1, ie the nextsibing element of every 
parent of the element you want to show and itself.
You will have to add to the translate value of those elements (4, 5 and 
8) the height of the element 3, then display 3

If you want to hide one element, you will have to remove the height of 3 
of the translate value 4, 5 and 8.

That said, you can imagine what initTree should do :
    read the tree:elements
    creatre the structure using <g> elements
    compute the height of any element
    hide all the child elements at first

And showhidechild() should do
    get the element that needs to be expanded or reduce (A)
    get the size of A
    add or remove this size to the translate of any nextsibing of any 
parent of A
    show or hide the childs of A

And this should work.


If you want to add or remove an child, don't forget to compute the new 
size of any parent of this

As you see, this shoud work for any type of child (text, graph, ... )


I hope it helps you.
but I would be pleased to have you comments, if it works and so...

J�r�me

Patricia LaRue wrote:

>Hi, Doug:
> 
>I responded to this earlier but as I read and learn more I am particularly 
>interested in your comments.  If I were to implement your version of the 
>solution, can you give me an idea of how it would be done?  Could it be done 
>in a object/tree structure?  Is it possible to set up objects for each task, 
>set the attributes (including a text attribute), add the element as a parent 
>or child element, and show/hide the child elements on click events?  How did 
>you do it?  All I need is an idea, I'll do the research.
> 
>Thanks a bunch,
>Patricia
> 
>
>Doug Schepers <[EMAIL PROTECTED]> wrote:
>Sorry, Peter, yes, I should have been more clear.
>
>I have no problem with the expanding/contracting bargraph idea, though it
>doesn't seem that tricky to me. Unless I'm misunderstanding something, I've
>seen (and done) similar things in SVG in the past, and I don't recall any
>particular challenges.
>
>I was speaking out against the misuse of glyphs. Too be fair to Philip,
>though, it's not unheard of in the computing tradition. In the Dark Ages of
>Computing, many specialized fonts used shape glyphs, for circuit diagrams
>and maps and other non-text compositional elements, as a kind of old-school
>'use' or 'symbol', in order to save memory on frequently-used shapes. There
>are large blocks of Unicode dedicated to this legacy, and I was told
>recently that certain industries still use this odd practice. 
>
>Regards-
>Doug
>
>doug . schepers  @ vectoreal.com
>www.vectoreal.com ...for scalable solutions.
>
>
>Peter Thompson wrote:
>| 
>| Patricia - It sounds like you are displaying a Gantt chart.  
>| I like Philip's first suggestion, perhaps because I haven't 
>| used glyphs.  I assume that you have a tree data structure 
>| somewhere with the parent/child relationships between the 
>| task/subtasks.  I'd use that to build a corresponding tree in 
>| SVG, then change visibility and the translate transform for 
>| each expand/contract.
>| 
>| Doug - Are you saying "don't use the glyph idea" or don't do 
>| the expanding/contracting bargraph?
>| 
>
>
>
>-----
>To unsubscribe send a message to: [EMAIL PROTECTED]
>-or-
>visit http://groups.yahoo.com/group/svg-developers and click "edit my 
>membership"
>---- 
>
>
>Yahoo! Groups SponsorADVERTISEMENT
>
>
>---------------------------------
>Yahoo! Groups Links
>
>   To visit your group on the web, go to:
>http://groups.yahoo.com/group/svg-developers/
>  
>   To unsubscribe from this group, send an email to:
>[EMAIL PROTECTED]
>  
>   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
>
>
>
>[Non-text portions of this message have been removed]
>
>
>
>
>-----
>To unsubscribe send a message to: [EMAIL PROTECTED]
>-or-
>visit http://groups.yahoo.com/group/svg-developers and click "edit my 
>membership"
>---- 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>  
>


-- 
J�r�me Tricand de la Goutte

Soci�t� Logatique
50 rue Marcel Dassault
92100 Boulogne-Billancourt

01 46 21 59 59



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/1U_rlB/TM
--------------------------------------------------------------------~-> 

-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to