You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Vincent Hardy <vi...@sun.com> on 2003/01/03 16:26:47 UTC

Re: Adding attributes to elements.

Hello Ernie,

Ernest Martinez wrote:
> I need to do it for content created from SVGGraphics2D. I dont exactly
> follow what you mean by "you'll need to look into the structure of what
> SVGGraphics2D manages" A code snippet would tell a thousand pictures.

What I meant was: look into the code of the classes I was mentioning. 
The documentation in these classes explain the structure of the content 
generated by SVG Graphics 2D.

Vincent.

> 
> Ernie
> 
> -----Original Message-----
> From: Vincent Hardy [mailto:vincent.hardy@sun.com]
> Sent: Monday, December 30, 2002 12:22 PM
> To: batik-dev@xml.apache.org
> Subject: Re: Adding attributes to elements.
> 
> 
> Hello Ernie,
> 
> Ernie wrote:
> 
>>Hi I'm new to Batik and have a rather simple yet frustrating question.
>>
>>I just need to be able to add some other attributes to some SVG elements
>>eg I need to add "my_id" to a rect element. I saw a thread which
>>addressed this exact issue but the only answer was to look at
>>org.apache.batik.svggen.SwingSVGPrettyPrint.
>>
>>This told me absolutely nothing. Can someone be kind enough to show me
>>an example of how this is accomplished.
>>
> 
> 
> Are you asking how to do this for content generated by SVGGraphics2D or
> for SVG content in general?
> 
> If you are creating content through the DOM, you would do:
> 
> Element r = document.createElementNS(svgNS, "rect");
> r.setAttribute("id", "my_id");
> 
> If you are wondering how to do that for content generated from
> SVGGraphics2D, you'll need t. This is documented in the DOMTreeManager and
> the
> DOMGroupManager classes. With that information and your knowledge of
> what you draw in an SVGGraphics2D, you can then access the content
> generated by SVGGraphics2D and add attributes to it...
> 
> If that is not answering your question, thanks for giving more details
> on what you want to accomplish.
> 
> Vincent.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Re: Adding attributes to elements.

Posted by Ernie <er...@oracle.com>.
Thanks a lot Vincent.

I was reading throught the code but this makes it much clearer, I think I
can take it from here :)

Ernie
----- Original Message -----
From: "Vincent Hardy" <vi...@sun.com>
To: <ba...@xml.apache.org>
Sent: Monday, January 06, 2003 3:06 AM
Subject: Re: Adding attributes to elements.


> Hello Ernie,
>
> Ernie wrote:
> > Ok, I'm not a Swing or SVG Guru, I'm just trying to get some answers to
my
> > people. I see what SVGGraphics2D is doing and I've read your article on
Suns
> > site as well as various responses you've made to people. What I'm
confused
> > about is;
> >
> >     Are you saying I need to modify SVGgraphics2D or do I just manipulte
the
> > DOM tree after SVGGraphics2D renders the SVG?
>
> I think you could do what you want by manipulating the DOM tree after
> SVGGraphics2D creates the SVG corresponding to the various drawing
> methods. Subclassing SVGGraphics2D is also possible.
>
>  > I've gone through the Javadocs
> > several times and what you're expecting me to find is not obvious to me,
> > there are hundreds of variables which I have no clue as to what they're
> > doing. I've also looked at the javadocs for DOMTreeManager and the
> > DOMGroupManager and still nothing is popping out at me. I just need a
hint
> > as to what I need to be looking for and what I'm expected to do with
respect
> > to the code. Should I be looking for an add_attribute method, should I
be
> > looking at SVGgraphics2D source code to see how the SVG is being
rendered
> > I'm completely in the dark at the moment.
>
> The SVGGraphics2D grows a DOM tree. When you call a method on
> SVGGraphics2D, SVGGraphics2D adds to the DOM tree it manages. As far as
> I understand, you want to add information to the bits of SVG
> corresponding to some specific drawing calls. For example, you'd like to
> add an id to the <rect> corresponding to a drawRect call on SVGGraphics2D.
>
> In order to do that, you need to:
>
> a. Understand the structure of the DOM that the SVGGraphics2D manipulates.
>
> b. Understand how to get access to the DOM information manipulated by
> the SVGGraphics2D.
>
> For a., you can have a look at the class documentation for DOMTreeManager:
>
> /**
>   * This class is used by the SVGGraphics2D SVG Generator to manage
>   * addition of new Nodes to the SVG DOM Tree. This class handles
>   * a set of DOMGroupManager objects that can all append to the
>   * top level group managed by this class. This allows multiple
>   * SVGGraphics2D instances, created from the same SVGGraphics2D
>   * through the various create methods, to append to the same
>   * SVG document and keep the rendering order correct.
>   *
>   * The root node managed by this DOMTreeManager contains two children:
>   * a top level group node and a top level defs node. The top level
>   * defs node contains the definition of common SVG entities such as
>   * the various AlphaComposite rules. Note that other defs can also be
>   * created under the top level group, for example to represent
>   * gradient or pattern paints.
>   * <br>
>   * [svg]
>   *   |
>   *   +-- [defs] Contain generic definitions
>   *   +-- [g]    Top level group
>   *        |
>   *        +-- [defs] Contains definitions specific to rendering
>   *        +-- [g]    Group 1
>   *        +-- ...
>   *        +-- [g]    Group n
>   *
>   */
>
> and DOMGroupManager:
>
> /**
>   * This class is used by the Graphics2D SVG Generator to manage
>   * a group of Nodes that can later be added to the SVG DOM Tree
>   * managed by the DOMTreeManager.
>   *
>   * There are two rules that control how children nodes are
>   * added to the group managed by this class:
>   *
>   * + Children node are added to the group as long as
>   *   there is no more than n graphic context overrides needed to
>   *   describe the children style. A graphic context override
>   *   happens when style attributes need to be added to a child
>   *   node to reflect the state of the graphic context at the
>   *   time the child was added. Note that the opacity is never
>   *   reflected in a group node and therefore, is not accounted
>   *   for in the number of overrides. The number of overrides can
>   *   be configured and defaults to 2.
>   * + Children nodes are added to the current group as long as
>   *   the associated GraphicContext's transform stack is valid.
>   *
>   * When children nodes can no longer be added, the group is considered
>   * complete and the associated DOMTreeManager is notified of the
>   * availability of a completed group. Then, a new group is started.
>   * <br>
>   * The DOMTreeManager is also notified every thime a new element
>   * is added to the current group. This is needed to let the
>   * DOMTreeManager handle group managers that would be used concurrently.
>   */
>
> To see how things work, you can look into SVGGraphics2D.draw(Shape).
>
> For b., the SwingSVGPrettyPrint class uses some the key methods:
> (getRoot(), getTopLevelGroup()) to access the generated DOM structure.
> So, to set ids on a <rect> you could, for example:
>
> SVGGraphics2D g = ...;
>
> // Get the Top Level Group managed by the DOMTreeManager.
> // This also causes g to use a new Top Level Group internally.
> Element tlg = g.getTopLevelGroup();
>
> // Draw a rect (in a new Top Level Group)
> g.drawRect(....);
>
> // Access the SVG corresponding to the rect and set whatever
> // additional information. Here, we add an id.
> Element rectGroup = g.getTopLevelGroup();
> rectGroup.setAttributeNS(null, "id", "myRect");
>
> // Append rect to original Top Level Group and make that group
> // the top level again.
> tlg.appendChild(rectGroup);
> g.setTopLevelGroup(tlg);
>
> If you want to avoid setting/resetting the Top you could also subclass
> SVGGraphics2D drawing methods (e.g., draw(Shape)) and add your specific
> information there (e.g., add some code to tag the content created by
> shapeConverter before it is inserted into the domGroupManager.
>
> Regards,
> Vincent.
>
> >
> > Thanks
> > Ernie
> > ----- Original Message -----
> > From: "Vincent Hardy" <vi...@sun.com>
> > To: <ba...@xml.apache.org>
> > Sent: Friday, January 03, 2003 10:57 AM
> > Subject: Re: Adding attributes to elements.
> >
> >
> >
> >>Hello Ernie,
> >>
> >>Ernie wrote:
> >>
> >>>I'm still not following what you are saying.
> >>>
> >>>You say "look into the code of the classes I was mentioning"
> >>>        what classes are you mentioning??
> >>
> >>In an earlier email, I mentioned the classes to look at:
> >>
> >>
> >>>If you are wondering how to do that for content generated from
> >>
> > SVGGraphics2D,
> >
> >> > you'll need to look into the structure of what SVGGraphics2D manages.
> >> > This is documented in the DOMTreeManager and the DOMGroupManager
> >> > classes.  > With that information and your knowledge of what you draw
> >
> > in an SVGGraphics2D,
> >
> >>>you can then access the content generated by SVGGraphics2D and add
> >>
> > attributes to it
> >
> >>This is the best I can offer today. I understand that you'd like an
> >>example but in the meantime, I think you could go a long way with
> >>a little homework on the classes I mentioned.
> >>
> >>Regards,
> >>Vincent.
> >>
> >>
> >>
> >>>The java docs documentation doesnt tell me anything about adding
> >>
> > elements.
> >
> >>>Like a said, an example would go a long way.
> >>>
> >>>Thanks
> >>>
> >>>Ernie
> >>>----- Original Message -----
> >>>From: "Vincent Hardy" <vi...@sun.com>
> >>>To: <ba...@xml.apache.org>
> >>>Sent: Friday, January 03, 2003 10:26 AM
> >>>Subject: Re: Adding attributes to elements.
> >>>
> >>>
> >>>
> >>>
> >>>>Hello Ernie,
> >>>>
> >>>>Ernest Martinez wrote:
> >>>>
> >>>>
> >>>>>I need to do it for content created from SVGGraphics2D. I dont
exactly
> >>>>>follow what you mean by "you'll need to look into the structure of
what
> >>>>>SVGGraphics2D manages" A code snippet would tell a thousand pictures.
> >>>>
> >>>>What I meant was: look into the code of the classes I was mentioning.
> >>>>The documentation in these classes explain the structure of the
content
> >>>>generated by SVG Graphics 2D.
> >>>>
> >>>>Vincent.
> >>>>
> >>>>
> >>>>
> >>>>>Ernie
> >>>>>
> >>>>>-----Original Message-----
> >>>>>From: Vincent Hardy [mailto:vincent.hardy@sun.com]
> >>>>>Sent: Monday, December 30, 2002 12:22 PM
> >>>>>To: batik-dev@xml.apache.org
> >>>>>Subject: Re: Adding attributes to elements.
> >>>>>
> >>>>>
> >>>>>Hello Ernie,
> >>>>>
> >>>>>Ernie wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>>Hi I'm new to Batik and have a rather simple yet frustrating
question.
> >>>>>>
> >>>>>>I just need to be able to add some other attributes to some SVG
> >>>>>
> > elements
> >
> >>>>>>eg I need to add "my_id" to a rect element. I saw a thread which
> >>>>>>addressed this exact issue but the only answer was to look at
> >>>>>>org.apache.batik.svggen.SwingSVGPrettyPrint.
> >>>>>>
> >>>>>>This told me absolutely nothing. Can someone be kind enough to show
me
> >>>>>>an example of how this is accomplished.
> >>>>>>
> >>>>>
> >>>>>
> >>>>>Are you asking how to do this for content generated by SVGGraphics2D
or
> >>>>>for SVG content in general?
> >>>>>
> >>>>>If you are creating content through the DOM, you would do:
> >>>>>
> >>>>>Element r = document.createElementNS(svgNS, "rect");
> >>>>>r.setAttribute("id", "my_id");
> >>>>>
> >>>>>If you are wondering how to do that for content generated from
> >>>>>SVGGraphics2D, you'll need t. This is documented in the
DOMTreeManager
> >>>>
> >>>and
> >>>
> >>>
> >>>>>the
> >>>>>DOMGroupManager classes. With that information and your knowledge of
> >>>>>what you draw in an SVGGraphics2D, you can then access the content
> >>>>>generated by SVGGraphics2D and add attributes to it...
> >>>>>
> >>>>>If that is not answering your question, thanks for giving more
details
> >>>>>on what you want to accomplish.
> >>>>>
> >>>>>Vincent.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Re: Adding attributes to elements.

Posted by Vincent Hardy <vi...@sun.com>.
Hello Ernie,

Ernie wrote:
> Ok, I'm not a Swing or SVG Guru, I'm just trying to get some answers to my
> people. I see what SVGGraphics2D is doing and I've read your article on Suns
> site as well as various responses you've made to people. What I'm confused
> about is;
> 
>     Are you saying I need to modify SVGgraphics2D or do I just manipulte the
> DOM tree after SVGGraphics2D renders the SVG? 

I think you could do what you want by manipulating the DOM tree after 
SVGGraphics2D creates the SVG corresponding to the various drawing 
methods. Subclassing SVGGraphics2D is also possible.

 > I've gone through the Javadocs
> several times and what you're expecting me to find is not obvious to me,
> there are hundreds of variables which I have no clue as to what they're
> doing. I've also looked at the javadocs for DOMTreeManager and the
> DOMGroupManager and still nothing is popping out at me. I just need a hint
> as to what I need to be looking for and what I'm expected to do with respect
> to the code. Should I be looking for an add_attribute method, should I be
> looking at SVGgraphics2D source code to see how the SVG is being rendered
> I'm completely in the dark at the moment.

The SVGGraphics2D grows a DOM tree. When you call a method on 
SVGGraphics2D, SVGGraphics2D adds to the DOM tree it manages. As far as 
I understand, you want to add information to the bits of SVG 
corresponding to some specific drawing calls. For example, you'd like to 
add an id to the <rect> corresponding to a drawRect call on SVGGraphics2D.

In order to do that, you need to:

a. Understand the structure of the DOM that the SVGGraphics2D manipulates.

b. Understand how to get access to the DOM information manipulated by 
the SVGGraphics2D.

For a., you can have a look at the class documentation for DOMTreeManager:

/**
  * This class is used by the SVGGraphics2D SVG Generator to manage
  * addition of new Nodes to the SVG DOM Tree. This class handles
  * a set of DOMGroupManager objects that can all append to the
  * top level group managed by this class. This allows multiple
  * SVGGraphics2D instances, created from the same SVGGraphics2D
  * through the various create methods, to append to the same
  * SVG document and keep the rendering order correct.
  *
  * The root node managed by this DOMTreeManager contains two children:
  * a top level group node and a top level defs node. The top level
  * defs node contains the definition of common SVG entities such as
  * the various AlphaComposite rules. Note that other defs can also be
  * created under the top level group, for example to represent
  * gradient or pattern paints.
  * <br>
  * [svg]
  *   |
  *   +-- [defs] Contain generic definitions
  *   +-- [g]    Top level group
  *        |
  *        +-- [defs] Contains definitions specific to rendering
  *        +-- [g]    Group 1
  *        +-- ...
  *        +-- [g]    Group n
  *
  */

and DOMGroupManager:

/**
  * This class is used by the Graphics2D SVG Generator to manage
  * a group of Nodes that can later be added to the SVG DOM Tree
  * managed by the DOMTreeManager.
  *
  * There are two rules that control how children nodes are
  * added to the group managed by this class:
  *
  * + Children node are added to the group as long as
  *   there is no more than n graphic context overrides needed to
  *   describe the children style. A graphic context override
  *   happens when style attributes need to be added to a child
  *   node to reflect the state of the graphic context at the
  *   time the child was added. Note that the opacity is never
  *   reflected in a group node and therefore, is not accounted
  *   for in the number of overrides. The number of overrides can
  *   be configured and defaults to 2.
  * + Children nodes are added to the current group as long as
  *   the associated GraphicContext's transform stack is valid.
  *
  * When children nodes can no longer be added, the group is considered
  * complete and the associated DOMTreeManager is notified of the
  * availability of a completed group. Then, a new group is started.
  * <br>
  * The DOMTreeManager is also notified every thime a new element
  * is added to the current group. This is needed to let the
  * DOMTreeManager handle group managers that would be used concurrently.
  */

To see how things work, you can look into SVGGraphics2D.draw(Shape).

For b., the SwingSVGPrettyPrint class uses some the key methods:
(getRoot(), getTopLevelGroup()) to access the generated DOM structure. 
So, to set ids on a <rect> you could, for example:

SVGGraphics2D g = ...;

// Get the Top Level Group managed by the DOMTreeManager.
// This also causes g to use a new Top Level Group internally.
Element tlg = g.getTopLevelGroup();

// Draw a rect (in a new Top Level Group)
g.drawRect(....);

// Access the SVG corresponding to the rect and set whatever
// additional information. Here, we add an id.
Element rectGroup = g.getTopLevelGroup();
rectGroup.setAttributeNS(null, "id", "myRect");

// Append rect to original Top Level Group and make that group
// the top level again.
tlg.appendChild(rectGroup);
g.setTopLevelGroup(tlg);

If you want to avoid setting/resetting the Top you could also subclass 
SVGGraphics2D drawing methods (e.g., draw(Shape)) and add your specific 
information there (e.g., add some code to tag the content created by 
shapeConverter before it is inserted into the domGroupManager.

Regards,
Vincent.

> 
> Thanks
> Ernie
> ----- Original Message -----
> From: "Vincent Hardy" <vi...@sun.com>
> To: <ba...@xml.apache.org>
> Sent: Friday, January 03, 2003 10:57 AM
> Subject: Re: Adding attributes to elements.
> 
> 
> 
>>Hello Ernie,
>>
>>Ernie wrote:
>>
>>>I'm still not following what you are saying.
>>>
>>>You say "look into the code of the classes I was mentioning"
>>>        what classes are you mentioning??
>>
>>In an earlier email, I mentioned the classes to look at:
>>
>>
>>>If you are wondering how to do that for content generated from
>>
> SVGGraphics2D,
> 
>> > you'll need to look into the structure of what SVGGraphics2D manages.
>> > This is documented in the DOMTreeManager and the DOMGroupManager
>> > classes.  > With that information and your knowledge of what you draw
> 
> in an SVGGraphics2D,
> 
>>>you can then access the content generated by SVGGraphics2D and add
>>
> attributes to it
> 
>>This is the best I can offer today. I understand that you'd like an
>>example but in the meantime, I think you could go a long way with
>>a little homework on the classes I mentioned.
>>
>>Regards,
>>Vincent.
>>
>>
>>
>>>The java docs documentation doesnt tell me anything about adding
>>
> elements.
> 
>>>Like a said, an example would go a long way.
>>>
>>>Thanks
>>>
>>>Ernie
>>>----- Original Message -----
>>>From: "Vincent Hardy" <vi...@sun.com>
>>>To: <ba...@xml.apache.org>
>>>Sent: Friday, January 03, 2003 10:26 AM
>>>Subject: Re: Adding attributes to elements.
>>>
>>>
>>>
>>>
>>>>Hello Ernie,
>>>>
>>>>Ernest Martinez wrote:
>>>>
>>>>
>>>>>I need to do it for content created from SVGGraphics2D. I dont exactly
>>>>>follow what you mean by "you'll need to look into the structure of what
>>>>>SVGGraphics2D manages" A code snippet would tell a thousand pictures.
>>>>
>>>>What I meant was: look into the code of the classes I was mentioning.
>>>>The documentation in these classes explain the structure of the content
>>>>generated by SVG Graphics 2D.
>>>>
>>>>Vincent.
>>>>
>>>>
>>>>
>>>>>Ernie
>>>>>
>>>>>-----Original Message-----
>>>>>From: Vincent Hardy [mailto:vincent.hardy@sun.com]
>>>>>Sent: Monday, December 30, 2002 12:22 PM
>>>>>To: batik-dev@xml.apache.org
>>>>>Subject: Re: Adding attributes to elements.
>>>>>
>>>>>
>>>>>Hello Ernie,
>>>>>
>>>>>Ernie wrote:
>>>>>
>>>>>
>>>>>
>>>>>>Hi I'm new to Batik and have a rather simple yet frustrating question.
>>>>>>
>>>>>>I just need to be able to add some other attributes to some SVG
>>>>>
> elements
> 
>>>>>>eg I need to add "my_id" to a rect element. I saw a thread which
>>>>>>addressed this exact issue but the only answer was to look at
>>>>>>org.apache.batik.svggen.SwingSVGPrettyPrint.
>>>>>>
>>>>>>This told me absolutely nothing. Can someone be kind enough to show me
>>>>>>an example of how this is accomplished.
>>>>>>
>>>>>
>>>>>
>>>>>Are you asking how to do this for content generated by SVGGraphics2D or
>>>>>for SVG content in general?
>>>>>
>>>>>If you are creating content through the DOM, you would do:
>>>>>
>>>>>Element r = document.createElementNS(svgNS, "rect");
>>>>>r.setAttribute("id", "my_id");
>>>>>
>>>>>If you are wondering how to do that for content generated from
>>>>>SVGGraphics2D, you'll need t. This is documented in the DOMTreeManager
>>>>
>>>and
>>>
>>>
>>>>>the
>>>>>DOMGroupManager classes. With that information and your knowledge of
>>>>>what you draw in an SVGGraphics2D, you can then access the content
>>>>>generated by SVGGraphics2D and add attributes to it...
>>>>>
>>>>>If that is not answering your question, thanks for giving more details
>>>>>on what you want to accomplish.
>>>>>
>>>>>Vincent.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Re: Adding attributes to elements.

Posted by Ernie <er...@oracle.com>.
Ok, I'm not a Swing or SVG Guru, I'm just trying to get some answers to my
people. I see what SVGGraphics2D is doing and I've read your article on Suns
site as well as various responses you've made to people. What I'm confused
about is;

    Are you saying I need to modify SVGgraphics2D or do I just manipulte the
DOM tree after SVGGraphics2D renders the SVG? I've gone through the Javadocs
several times and what you're expecting me to find is not obvious to me,
there are hundreds of variables which I have no clue as to what they're
doing. I've also looked at the javadocs for DOMTreeManager and the
DOMGroupManager and still nothing is popping out at me. I just need a hint
as to what I need to be looking for and what I'm expected to do with respect
to the code. Should I be looking for an add_attribute method, should I be
looking at SVGgraphics2D source code to see how the SVG is being rendered
I'm completely in the dark at the moment.

Thanks
Ernie
----- Original Message -----
From: "Vincent Hardy" <vi...@sun.com>
To: <ba...@xml.apache.org>
Sent: Friday, January 03, 2003 10:57 AM
Subject: Re: Adding attributes to elements.


> Hello Ernie,
>
> Ernie wrote:
> > I'm still not following what you are saying.
> >
> > You say "look into the code of the classes I was mentioning"
> >         what classes are you mentioning??
>
> In an earlier email, I mentioned the classes to look at:
>
> > If you are wondering how to do that for content generated from
SVGGraphics2D,
>  > you'll need to look into the structure of what SVGGraphics2D manages.
>  > This is documented in the DOMTreeManager and the DOMGroupManager
>  > classes.  > With that information and your knowledge of what you draw
in an SVGGraphics2D,
> > you can then access the content generated by SVGGraphics2D and add
attributes to it
>
> This is the best I can offer today. I understand that you'd like an
> example but in the meantime, I think you could go a long way with
> a little homework on the classes I mentioned.
>
> Regards,
> Vincent.
>
>
> > The java docs documentation doesnt tell me anything about adding
elements.
> >
> > Like a said, an example would go a long way.
> >
> > Thanks
> >
> > Ernie
> > ----- Original Message -----
> > From: "Vincent Hardy" <vi...@sun.com>
> > To: <ba...@xml.apache.org>
> > Sent: Friday, January 03, 2003 10:26 AM
> > Subject: Re: Adding attributes to elements.
> >
> >
> >
> >>Hello Ernie,
> >>
> >>Ernest Martinez wrote:
> >>
> >>>I need to do it for content created from SVGGraphics2D. I dont exactly
> >>>follow what you mean by "you'll need to look into the structure of what
> >>>SVGGraphics2D manages" A code snippet would tell a thousand pictures.
> >>
> >>What I meant was: look into the code of the classes I was mentioning.
> >>The documentation in these classes explain the structure of the content
> >>generated by SVG Graphics 2D.
> >>
> >>Vincent.
> >>
> >>
> >>>Ernie
> >>>
> >>>-----Original Message-----
> >>>From: Vincent Hardy [mailto:vincent.hardy@sun.com]
> >>>Sent: Monday, December 30, 2002 12:22 PM
> >>>To: batik-dev@xml.apache.org
> >>>Subject: Re: Adding attributes to elements.
> >>>
> >>>
> >>>Hello Ernie,
> >>>
> >>>Ernie wrote:
> >>>
> >>>
> >>>>Hi I'm new to Batik and have a rather simple yet frustrating question.
> >>>>
> >>>>I just need to be able to add some other attributes to some SVG
elements
> >>>>eg I need to add "my_id" to a rect element. I saw a thread which
> >>>>addressed this exact issue but the only answer was to look at
> >>>>org.apache.batik.svggen.SwingSVGPrettyPrint.
> >>>>
> >>>>This told me absolutely nothing. Can someone be kind enough to show me
> >>>>an example of how this is accomplished.
> >>>>
> >>>
> >>>
> >>>Are you asking how to do this for content generated by SVGGraphics2D or
> >>>for SVG content in general?
> >>>
> >>>If you are creating content through the DOM, you would do:
> >>>
> >>>Element r = document.createElementNS(svgNS, "rect");
> >>>r.setAttribute("id", "my_id");
> >>>
> >>>If you are wondering how to do that for content generated from
> >>>SVGGraphics2D, you'll need t. This is documented in the DOMTreeManager
> >>
> > and
> >
> >>>the
> >>>DOMGroupManager classes. With that information and your knowledge of
> >>>what you draw in an SVGGraphics2D, you can then access the content
> >>>generated by SVGGraphics2D and add attributes to it...
> >>>
> >>>If that is not answering your question, thanks for giving more details
> >>>on what you want to accomplish.
> >>>
> >>>Vincent.
> >>>
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> >>>For additional commands, e-mail: batik-dev-help@xml.apache.org
> >>>
> >>>
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> >>>For additional commands, e-mail: batik-dev-help@xml.apache.org
> >>>
> >>>
> >>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> >>For additional commands, e-mail: batik-dev-help@xml.apache.org
> >>
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-dev-help@xml.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Re: Adding attributes to elements.

Posted by Vincent Hardy <vi...@sun.com>.
Hello Ernie,

Ernie wrote:
> I'm still not following what you are saying.
> 
> You say "look into the code of the classes I was mentioning"
>         what classes are you mentioning??

In an earlier email, I mentioned the classes to look at:

> If you are wondering how to do that for content generated from SVGGraphics2D, 
 > you'll need to look into the structure of what SVGGraphics2D manages.
 > This is documented in the DOMTreeManager and the DOMGroupManager
 > classes.  > With that information and your knowledge of what you draw in an SVGGraphics2D, 
> you can then access the content generated by SVGGraphics2D and add attributes to it

This is the best I can offer today. I understand that you'd like an
example but in the meantime, I think you could go a long way with
a little homework on the classes I mentioned.

Regards,
Vincent.


> The java docs documentation doesnt tell me anything about adding elements.
> 
> Like a said, an example would go a long way.
> 
> Thanks
> 
> Ernie
> ----- Original Message -----
> From: "Vincent Hardy" <vi...@sun.com>
> To: <ba...@xml.apache.org>
> Sent: Friday, January 03, 2003 10:26 AM
> Subject: Re: Adding attributes to elements.
> 
> 
> 
>>Hello Ernie,
>>
>>Ernest Martinez wrote:
>>
>>>I need to do it for content created from SVGGraphics2D. I dont exactly
>>>follow what you mean by "you'll need to look into the structure of what
>>>SVGGraphics2D manages" A code snippet would tell a thousand pictures.
>>
>>What I meant was: look into the code of the classes I was mentioning.
>>The documentation in these classes explain the structure of the content
>>generated by SVG Graphics 2D.
>>
>>Vincent.
>>
>>
>>>Ernie
>>>
>>>-----Original Message-----
>>>From: Vincent Hardy [mailto:vincent.hardy@sun.com]
>>>Sent: Monday, December 30, 2002 12:22 PM
>>>To: batik-dev@xml.apache.org
>>>Subject: Re: Adding attributes to elements.
>>>
>>>
>>>Hello Ernie,
>>>
>>>Ernie wrote:
>>>
>>>
>>>>Hi I'm new to Batik and have a rather simple yet frustrating question.
>>>>
>>>>I just need to be able to add some other attributes to some SVG elements
>>>>eg I need to add "my_id" to a rect element. I saw a thread which
>>>>addressed this exact issue but the only answer was to look at
>>>>org.apache.batik.svggen.SwingSVGPrettyPrint.
>>>>
>>>>This told me absolutely nothing. Can someone be kind enough to show me
>>>>an example of how this is accomplished.
>>>>
>>>
>>>
>>>Are you asking how to do this for content generated by SVGGraphics2D or
>>>for SVG content in general?
>>>
>>>If you are creating content through the DOM, you would do:
>>>
>>>Element r = document.createElementNS(svgNS, "rect");
>>>r.setAttribute("id", "my_id");
>>>
>>>If you are wondering how to do that for content generated from
>>>SVGGraphics2D, you'll need t. This is documented in the DOMTreeManager
>>
> and
> 
>>>the
>>>DOMGroupManager classes. With that information and your knowledge of
>>>what you draw in an SVGGraphics2D, you can then access the content
>>>generated by SVGGraphics2D and add attributes to it...
>>>
>>>If that is not answering your question, thanks for giving more details
>>>on what you want to accomplish.
>>>
>>>Vincent.
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
>>>For additional commands, e-mail: batik-dev-help@xml.apache.org
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
>>>For additional commands, e-mail: batik-dev-help@xml.apache.org
>>>
>>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
>>For additional commands, e-mail: batik-dev-help@xml.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Re: Adding attributes to elements.

Posted by Ernie <er...@oracle.com>.
I'm still not following what you are saying.

You say "look into the code of the classes I was mentioning"
        what classes are you mentioning??
The java docs documentation doesnt tell me anything about adding elements.

Like a said, an example would go a long way.

Thanks

Ernie
----- Original Message -----
From: "Vincent Hardy" <vi...@sun.com>
To: <ba...@xml.apache.org>
Sent: Friday, January 03, 2003 10:26 AM
Subject: Re: Adding attributes to elements.


> Hello Ernie,
>
> Ernest Martinez wrote:
> > I need to do it for content created from SVGGraphics2D. I dont exactly
> > follow what you mean by "you'll need to look into the structure of what
> > SVGGraphics2D manages" A code snippet would tell a thousand pictures.
>
> What I meant was: look into the code of the classes I was mentioning.
> The documentation in these classes explain the structure of the content
> generated by SVG Graphics 2D.
>
> Vincent.
>
> >
> > Ernie
> >
> > -----Original Message-----
> > From: Vincent Hardy [mailto:vincent.hardy@sun.com]
> > Sent: Monday, December 30, 2002 12:22 PM
> > To: batik-dev@xml.apache.org
> > Subject: Re: Adding attributes to elements.
> >
> >
> > Hello Ernie,
> >
> > Ernie wrote:
> >
> >>Hi I'm new to Batik and have a rather simple yet frustrating question.
> >>
> >>I just need to be able to add some other attributes to some SVG elements
> >>eg I need to add "my_id" to a rect element. I saw a thread which
> >>addressed this exact issue but the only answer was to look at
> >>org.apache.batik.svggen.SwingSVGPrettyPrint.
> >>
> >>This told me absolutely nothing. Can someone be kind enough to show me
> >>an example of how this is accomplished.
> >>
> >
> >
> > Are you asking how to do this for content generated by SVGGraphics2D or
> > for SVG content in general?
> >
> > If you are creating content through the DOM, you would do:
> >
> > Element r = document.createElementNS(svgNS, "rect");
> > r.setAttribute("id", "my_id");
> >
> > If you are wondering how to do that for content generated from
> > SVGGraphics2D, you'll need t. This is documented in the DOMTreeManager
and
> > the
> > DOMGroupManager classes. With that information and your knowledge of
> > what you draw in an SVGGraphics2D, you can then access the content
> > generated by SVGGraphics2D and add attributes to it...
> >
> > If that is not answering your question, thanks for giving more details
> > on what you want to accomplish.
> >
> > Vincent.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-dev-help@xml.apache.org
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-dev-help@xml.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org