/ftr-gwt-library-date/src/main/java/eu/future/earth/gwt/client/date/week/WeekScrollEvent.java
http://ftr-gwt-library.googlecode.com/ · Java · 92 lines · 41 code · 14 blank · 37 comment · 4 complexity · e14bf0dc3de4ed3850e3a0cb5385cebd MD5 · raw file
- /*
- * Copyright 2007 Future Earth, info@future-earth.eu
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
- package eu.future.earth.gwt.client.date.week;
-
- import com.google.gwt.event.shared.GwtEvent;
-
- public class WeekScrollEvent extends GwtEvent<WeekScrollEventHandler> {
-
- private static final long serialVersionUID = -3798647759325157673L;
-
- private int pos = -1;
-
- public WeekScrollEvent() {
- super();
- }
-
- /**
- * Handler type.
- */
- private static Type<WeekScrollEventHandler> TYPE;
-
- /**
- * Fires a before selection event on all registered handlers in the handler manager. If no such handlers exist, this
- * method will do nothing.
- *
- * @param source
- * the source of the handlers
- * @param navigator
- * the navigator associated with this event
- * @param token
- * the navigation token associated with this event
- * @return the event so that the caller can check if it was canceled, or null if no handlers of this event type have
- * been registered
- */
- public static WeekScrollEvent fire(HasWeekScrollEventHandlers source, int navigator) {
- // If no handlers exist, then type can be null.
- if (TYPE != null) {
- final WeekScrollEvent event = new WeekScrollEvent(navigator);
- source.fireEvent(event);
- return event;
- }
- return null;
- }
-
- public int getPos() {
- return pos;
- }
-
- /**
- * Gets the type associated with this event.
- *
- * @return returns the handler type
- */
- public static Type<WeekScrollEventHandler> getType() {
- if (TYPE == null) {
- TYPE = new Type<WeekScrollEventHandler>();
- }
- return TYPE;
- }
-
- protected WeekScrollEvent(int newPos) {
- super();
- pos = newPos;
- }
-
- @SuppressWarnings({
- "unchecked", "rawtypes"
- })
- @Override
- public final Type<WeekScrollEventHandler> getAssociatedType() {
- return (Type) TYPE;
- }
-
- protected void dispatch(WeekScrollEventHandler handler) {
- handler.handleScrollEvent(this);
- }
-
- }