1 26 27 package org.nightlabs.editor2d.viewer.action; 28 29 import java.awt.Rectangle ; 30 31 import org.apache.log4j.Logger; 32 import org.nightlabs.editor2d.viewer.IZoomSupport; 33 import org.nightlabs.editor2d.viewer.ViewerPlugin; 34 import org.nightlabs.editor2d.viewer.util.TransformUtil; 35 36 public class ZoomAllAction 37 extends ZoomAction 38 { 39 public static final String ID = ZoomAllAction.class.getName(); 40 public static final Logger LOGGER = Logger.getLogger(ZoomAllAction.class); 41 42 public ZoomAllAction() { 43 super(); 44 } 45 46 public ZoomAllAction(IZoomSupport zoomSupport) 47 { 48 super(zoomSupport); 49 this.zoom = zoomSupport.getZoom(); 50 } 51 52 public void init() 53 { 54 setId(ID); 55 setText(ViewerPlugin.getResourceString("action.zoomAll.text")); 56 setToolTipText(ViewerPlugin.getResourceString("action.zoomAll.tooltip")); 57 } 58 59 double zoom = 1.0d; 60 public void zoomChanged(double zoom) { 61 this.zoom = zoom; 62 } 63 64 public void run() 65 { 66 Rectangle bounds = getZoomSupport().getViewport().getRealBounds(); 68 Rectangle absoluteRealBounds = TransformUtil.toAbsolute(bounds, zoom, true); 69 getZoomSupport().zoomTo(absoluteRealBounds); 71 72 LOGGER.debug("real bounds = "+bounds); 73 LOGGER.debug("view Bounds = "+getZoomSupport().getViewport().getViewBounds()); 74 LOGGER.debug("zoom = "+zoom); 75 LOGGER.debug("absolute real bounds = "+absoluteRealBounds); 76 } 77 } 78 | Popular Tags |