You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by "De Winne, Joris" <jo...@barco.com> on 2005/03/24 09:27:24 UTC

Changing colors - alarm

Hello,

Is there a good example on how to use the UpdateManager and the
UpdateRunnableQueue? What I'm trying to do is the following:
I've a rectangle that is having a stroke (border). Every second I want to
change the color of that stroke, without clicking or moving over the
rectangle.

This is the code I'm using for the moment, whithout any result:

public void gvtRenderingCompleted(GVTTreeRendererEvent evt) {
            UpdateManager um = SVGViewerImpl.component.getUpdateManager();
            int i = 0;

            while (i < 9) {
                try {
                    i++;
                    if (um.getUpdateRunnableQueue() != null) {
                        um.getUpdateRunnableQueue().invokeAndWait(new
Runnable() {
                            public void run() {
                                // Insert some actions on the DOM here
                                node.setAttributeNS(null,
SVGConstants.SVG_STROKE_ATTRIBUTE, strokeColor);
                            }
                        });
                    }
                    Thread.sleep(1000);
                    System.out.println("Changed color: " + strokeColor);
                    if (um.getUpdateRunnableQueue() != null) {
                        um.getUpdateRunnableQueue().invokeAndWait(new
Runnable() {
                            public void run() {
                                // Insert some actions on the DOM here
                                node.setAttributeNS(null,
SVGConstants.SVG_STROKE_ATTRIBUTE, alarmColor);
                            }
                        });
                    }

                    Thread.sleep(1000);
                    System.out.println("Changed color: " + alarmColor);

                } catch (InterruptedException exp) {
                    exp.printStackTrace();
                }
            }
            System.out.println("End changing color");
        }
    }

The only color I see is the strokeColor, never the alarmColor. Any help is
welcome!

Joris
- - - - - - - DISCLAIMER- - - - - - - -
Unless indicated otherwise, the information contained in this message is
privileged and confidential, and is intended only for the use of the
addressee(s) named above and others who have been specifically authorized to
receive it. If you are not the intended recipient, you are hereby notified
that any dissemination, distribution or copying of this message and/or
attachments is strictly prohibited. The company accepts no liability for any
damage caused by any virus transmitted by this email. Furthermore, the
company does not warrant a proper and complete transmission of this
information, nor does it accept liability for any delays. If you have
received this message in error, please contact the sender and delete the
message. Thank you.