1 18 package org.apache.batik.dom.svg; 19 20 import org.apache.batik.dom.AbstractNode; 21 import org.apache.batik.util.SVGConstants; 22 import org.w3c.dom.DOMException ; 23 import org.w3c.dom.Element ; 24 import org.w3c.dom.svg.SVGZoomAndPan; 25 26 32 public class SVGZoomAndPanSupport implements SVGConstants { 33 34 37 protected SVGZoomAndPanSupport() { 38 } 39 40 43 public static void setZoomAndPan(Element elt, short val) 44 throws DOMException { 45 switch (val) { 46 case SVGZoomAndPan.SVG_ZOOMANDPAN_DISABLE: 47 elt.setAttributeNS(null, SVG_ZOOM_AND_PAN_ATTRIBUTE, 48 SVG_DISABLE_VALUE); 49 break; 50 case SVGZoomAndPan.SVG_ZOOMANDPAN_MAGNIFY: 51 elt.setAttributeNS(null, SVG_ZOOM_AND_PAN_ATTRIBUTE, 52 SVG_MAGNIFY_VALUE); 53 break; 54 default: 55 throw ((AbstractNode)elt).createDOMException 56 (DOMException.INVALID_MODIFICATION_ERR, 57 "zoom.and.pane", 58 new Object [] { new Integer (val) }); 59 } 60 } 61 62 65 public static short getZoomAndPan(Element elt) { 66 String s = elt.getAttributeNS(null, SVG_ZOOM_AND_PAN_ATTRIBUTE); 67 if (s.equals(SVG_MAGNIFY_VALUE)) { 68 return SVGZoomAndPan.SVG_ZOOMANDPAN_MAGNIFY; 69 } 70 return SVGZoomAndPan.SVG_ZOOMANDPAN_DISABLE; 71 } 72 } 73 | Popular Tags |