Thanks a lot for your reply thomas :) That's helped clear up quite a few things.
I've managed to now get the basic initial interface screen working now
and its looking good :) I'm hoping to open source this once I've
finished but with it being uni I'm not holding my breath :/
On 2/15/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi Lewis,
>
> Lewis Keen <[EMAIL PROTECTED]> wrote on 02/12/2006 09:37:17 PM:
>
> > 1) I currently have a button class that does all of the adding of the
> > xml to the document etc. and was wondering if there was an easier way
> > of doing this? Most of the examples I've seen suggest that I simply
> > use the Document/Element to build my document up, and that is what I
> > am doing atm, I was just wondering if there was a more elegant way of
> > doing it.
>
> Well some people will clone an 'example' piece of XML. Some things
> you can use the 'use' element.
I am currently using the use elements, only problem was that the
button was different sizes depending on the text. Thank god I found
the text-anchor ;)
My question was actually about using Element.appendChild to the
Document, but I noticed when I was debugging that batik uses its own
classes to construct the document in the background anyway, so I guess
I don't need to worry about that :)
>
> > 2) Updating of the SVG once its been modified. Yes I know this has
> > been a problem with a few people :) I've implemented it in the way I
> > think is right, but from some reason its not working :/ I have a
> > status indicator in the bottom right that changes to yellow when
> > connecting and green when connected. However, the change from red to
> > yellow and yellow to green is about 2-3 seconds each.
>
> The problem is the massive filter effect on the whole canvas:
>
I had a feeling it was the filter, and as soon as I took it away it
worked :) bit of a shame, it looked really good, I may implement that
as a setting that can be toggled by the user for fast machines (my one
at home is a mid to low-range machine).
> > 3) More examples - are there any? I've always been someone who's found
> > it easier to learn from example rather than trawling through pages of
> > javadoc. Looking at the site there are a few examples but not that
> > many and was wondering if I had missed anything.
>
> The samples directory has lots of example SVG. The solitaire
> examples are just one, there is also a minesweeper game and a
> few other 'interactive' documents that at least give examples of
> how other people think SVG should be manipulated.
>
I looked at the examples and liked them :) only problem with them is
that they don't really give you any java-related examples. i guess
that's why I downloaded the squiggle source :)
> > such as sending the client the svg of each of the cards that they can
> > see on the board.
>
> Why would you send them SVG? I would send them something like:
> '2H' or 'KS' (two of harts, king of spades). Is there any reason
> they wouldn't have all the 'card' stuff themselves?
I'm not sure to be honest, it was suggested to me and I thought it was
a good idea at the tme. The card would be 500bytes max so no issues
with bandwidth, and in my server-client model it makes sense, since
the client is very "dumb" and all of the processing is done on the
server. I also didn't want to take up a huge amount of memory with
loading the cards in (ok, it is only 35K total, but we know what java
is like ;)).
>
> > I can see how to do it using Document/Element but
> > again its a case of is there a more elegant way?
>
> Well the solitaire examples use the 'use' element with
> a base 'deck' SVG file and the card names (as above) are
> the 'id' of the individual cards.
That's how I have it atm, I'm gonna use those if I don't have enough time :)
>
> > 4) Any general tips about my code (see below). Its kinda messy atm and
> > I'm not sure if I've got everything I need in there to make things
> > work correctly. I'm not asking for someone to write the code for me,
> > just point me in the right direction :)
>
> > Element svgRoot = document.getDocumentElement();
> > NodeList rootElements=
> svgRoot.getElementsByTagName("circle");
> > Element status=(Element)rootElements.item(0);
> > status.setAttributeNS(null,"fill",color);
>
> 'getElementById' is much faster (now at least) and doesn't depend on
> there
> being only one circle in the document.
>
Changed :) had a feeling there was an easier way.
Again, thanks for your help :)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]