1 /********************************************** 2 * Copyright (C) 2010 Lukas Laag 3 * This file is part of svgreal. 4 * 5 * svgreal is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * svgreal is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with svgreal. If not, see http://www.gnu.org/licenses/ 17 **********************************************/ 18 package org.vectomatic.svg.edit.client.event; 19 20 import com.google.gwt.event.shared.GwtEvent; 21 22 /** 23 * Event emitted when a scaling occurs 24 * @author laaglu 25 */ 26 public class ScalingEvent extends GwtEvent<ScalingHandler> { 27 /** 28 * Handler type. 29 */ 30 private static Type<ScalingHandler> TYPE; 31 32 private final float scale; 33 34 public ScalingEvent(float scale) { 35 this.scale = scale; 36 } 37 38 @Override 39 public com.google.gwt.event.shared.GwtEvent.Type<ScalingHandler> getAssociatedType() { 40 if (TYPE == null) { 41 TYPE = new Type<ScalingHandler>(); 42 } 43 return TYPE; 44 } 45 46 /** 47 * Ensures the existence of the handler hook and then returns it. 48 * 49 * @return returns a handler hook 50 */ 51 public static Type<ScalingHandler> getType() { 52 if (TYPE == null) { 53 TYPE = new Type<ScalingHandler>(); 54 } 55 return TYPE; 56 } 57 58 @Override 59 protected void dispatch(ScalingHandler handler) { 60 handler.onScale(this); 61 } 62 63 public float getScale() { 64 return scale; 65 } 66 67 }