ResizeEvent class
Fired when the event source is resized.
class ResizeEvent extends DwtEvent {
/**
* The event type.
*/
static EventType<ResizeHandler> TYPE = new EventType<ResizeHandler>();
/**
* Fires a resize event on all registered handlers in the handler source.
*
* @param <S> The handler source
* @param source the source of the handlers
* @param width the new width
* @param height the new height
*/
static void fire(HasHandlers source, int width, int height) {
if (TYPE != null) {
ResizeEvent event = new ResizeEvent(width, height);
source.fireEvent(event);
}
}
int _width;
int _height;
/**
* Construct a new {@link ResizeEvent}.
*
* @param _width the new width
* @param _height the new height
*/
ResizeEvent(this._width, this._height);
EventType<ResizeHandler> getAssociatedType() {
return TYPE;
}
/**
* Returns the new height.
*
* @return the new height
*/
int get height =>_height;
/**
* Returns the new width.
*
* @return the new width
*/
int get width =>_width;
void dispatch(ResizeHandler handler) {
handler.onResize(this);
}
}
Extends
IEvent<H> > DwtEvent > ResizeEvent
Static Properties
EventType<ResizeHandler> TYPE #
The event type.
static EventType<ResizeHandler> TYPE = new EventType<ResizeHandler>()
Static Methods
void fire(HasHandlers source, int width, int height) #
Fires a resize event on all registered handlers in the handler source.
@param <S> The handler source @param source the source of the handlers @param width the new width @param height the new height
static void fire(HasHandlers source, int width, int height) {
if (TYPE != null) {
ResizeEvent event = new ResizeEvent(width, height);
source.fireEvent(event);
}
}
Constructors
new ResizeEvent(int _width, int _height) #
Construct a new {@link ResizeEvent}.
@param width the new width @param height the new height
ResizeEvent(this._width, this._height);
Properties
final int height #
Returns the new height.
@return the new height
int get height =>_height;
final int width #
Returns the new width.
@return the new width
int get width =>_width;
Methods
void assertLive() #
Asserts that the event still should be accessed. All events are considered to be "dead" after their original handler manager finishes firing them. An event can be revived by calling {@link GwtEvent#revive()}.
void assertLive() {
assert (!_dead) ; //: "This event has already finished being processed by its original handler manager, so you can no longer access it";
}
void dispatch(ResizeHandler handler) #
Implemented by subclasses to invoke their handlers in a type safe
manner. Intended to be called by EventBus#fireEvent(Event) or
EventBus#fireEventFromSource(Event, Object).
@param handler handler @see EventBus#dispatchEvent(Event, Object)
void dispatch(ResizeHandler handler) {
handler.onResize(this);
}
EventType<ResizeHandler> getAssociatedType() #
Object getSource() #
Returns the source for this event. The type and meaning of the source is
arbitrary, and is most useful as a secondary key for handler registration.
(See EventBus#addHandlerToSource, which allows a handler to
register for events of a particular type, tied to a particular source.)
Note that the source is actually set at dispatch time, e.g. via
EventBus#fireEventFromSource(Event, Object).
@return object representing the source of this event
Object getSource() {
assertLive();
return super.getSource();
}
bool isLive() #
Is the event current live?
@return whether the event is live
bool isLive() {
return !_dead;
}
void kill() #
Kill the event. After the event has been killed, users cannot really on its values or functions being available.
void kill() {
_dead = true;
setSource(null);
}
void overrideSource(Object source) #
void overrideSource(Object source) {
super.setSource(source);
}
void revive() #
Revives the event. Used when recycling event instances.
void revive() {
_dead = false;
setSource(null);
}
void setSource(source) #
Set the source that triggered this event. Intended to be called by the EventBus during dispatch.
@param source the source of this event. @see EventBus#fireEventFromSource(Event, Object) @see EventBus#setSourceOfEvent(Event, Object)
void setSource(dynamic source) {
this._source = source;
}