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 tk...@apache.org on 2001/11/02 10:47:58 UTC

cvs commit: xml-batik/sources/org/apache/batik/bridge BridgeEventSupport.java

tkormann    01/11/02 01:47:58

  Modified:    sources/org/apache/batik/bridge BridgeEventSupport.java
  Log:
  add new scripting directory
  
  Revision  Changes    Path
  1.17      +20 -5     xml-batik/sources/org/apache/batik/bridge/BridgeEventSupport.java
  
  Index: BridgeEventSupport.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/BridgeEventSupport.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- BridgeEventSupport.java	2001/10/10 15:30:59	1.16
  +++ BridgeEventSupport.java	2001/11/02 09:47:58	1.17
  @@ -53,7 +53,7 @@
    * on the GVT root to propagate GVT events to the DOM.
    * @author <a href="mailto:cjolif@ilog.fr>Christophe Jolif</a>
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: BridgeEventSupport.java,v 1.16 2001/10/10 15:30:59 cjolif Exp $
  + * @version $Id: BridgeEventSupport.java,v 1.17 2001/11/02 09:47:58 tkormann Exp $
    */
   class BridgeEventSupport implements SVGConstants {
       private static final String[] EVENT_ATTRIBUTES_GRAPHICS = {
  @@ -356,11 +356,26 @@
                           ua.displayError(new Exception("scripting error: "+
                                                         e.getMessage()));
                   }
  -            } else
  -                if (ua != null)
  +            } else {
  +                if (ua != null) {
                       ua.displayError(new Exception("unknown language: "+language));
  -        }
  -    }
  +		}
  +	    }
  +	}
  +
  +	// add a function definition 'alert'
  +	final Interpreter interpret =
  +	    ctx.getInterpreterPool().getInterpreter(doc, language);
  +	if (interpret != null) {
  +	    try {
  +		javax.swing.JOptionPane pane = new javax.swing.JOptionPane();
  +		interpret.bindObject("pane", pane);
  +		interpret.evaluate("function alert(msg) { pane.showMessageDialog(null, msg); }");
  +	    } catch (Exception ex) {
  +		// nothing to do
  +	    }
  +	}
  +   }
   
       private static class GVTUnloadListener
           implements EventListener {
  
  
  

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