com.google.gwt.event.shared.GwtEvent Java Examples

The following examples show how to use com.google.gwt.event.shared.GwtEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MaterialPopupMenuTest.java    From gwt-material-addins with Apache License 2.0 6 votes vote down vote up
protected void checkSelectionHandler(MaterialPopupMenu popupMenu) {
    final boolean[] isSelectionFired = {false};
    popupMenu.setEnabled(true);
    popupMenu.addSelectionHandler(selectionEvent -> isSelectionFired[0] = true);
    popupMenu.fireEvent(new GwtEvent<SelectionHandler<?>>() {
        @Override
        public Type<SelectionHandler<?>> getAssociatedType() {
            return SelectionEvent.getType();
        }

        @Override
        protected void dispatch(SelectionHandler<?> eventHandler) {
            eventHandler.onSelection(null);
        }
    });
    assertTrue(isSelectionFired[0]);
}
 
Example #2
Source File: MaterialNavSectionTest.java    From gwt-material with Apache License 2.0 6 votes vote down vote up
public void testSelectionEvent() {
    MaterialNavSection widget = new MaterialNavSection();

    final boolean[] isSelectionEventFired = {false};
    widget.addSelectionHandler(selectionEvent -> isSelectionEventFired[0] = true);
    widget.fireEvent(new GwtEvent<SelectionHandler<?>>() {
        @Override
        public Type<SelectionHandler<?>> getAssociatedType() {
            return SelectionEvent.getType();
        }

        @Override
        protected void dispatch(SelectionHandler eventHandler) {
            eventHandler.onSelection(null);
        }
    });

    assertTrue(isSelectionEventFired[0]);
}
 
Example #3
Source File: KeyShortcutHandler.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onKeyDown(final KeyDownEvent event) {

	if (event.getNativeKeyCode() == keyCode) {				
		actionButton.fireEvent( new GwtEvent<ClickHandler>() {
	        @Override
	        public com.google.gwt.event.shared.GwtEvent.Type<ClickHandler> getAssociatedType() {
	        	return ClickEvent.getType();
	        }
	        @Override
	        protected void dispatch(final ClickHandler handler) {
	            handler.onClick(null);
	        }
	   });
	}
}
 
Example #4
Source File: DropEventDispatcher.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
public void fireDropActiveEvent() {
    target.fireEvent(new GwtEvent<DropActivateEvent.DropActivateHandler>() {
        @Override
        public Type<DropActivateEvent.DropActivateHandler> getAssociatedType() {
            return DropActivateEvent.TYPE;
        }

        @Override
        protected void dispatch(DropActivateEvent.DropActivateHandler handler) {
            handler.onDropActivate(new DropActivateEvent());
        }
    });
}
 
Example #5
Source File: EventBus.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void fireEvent(GwtEvent<?> event) {
    try {
        if (!GWT.isProdMode()) {
            GWT.log("Firing " + event.toDebugString()); 
        }
        super.fireEvent(event);
    } catch (Exception e) {
        ExceptionHandler.handleUnexpectedException(e);
    }
}
 
Example #6
Source File: MaterialTabTest.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
public void testDynamicTab() {
    // given
    MaterialTab tab = getWidget();

    // when / then
    // This will dynamically add new Tab Item
    MaterialTabItem item = newTabItem(tab, row, 1);

    boolean[] selectionEventFired = new boolean[]{false};
    tab.addSelectionHandler(selectionEvent -> selectionEventFired[0] = true);

    // This will trigger the selection event of the tab once tab item fired MouseDownEvent
    item.fireEvent(new GwtEvent<MouseDownHandler>() {
        @Override
        public Type<MouseDownHandler> getAssociatedType() {
            return MouseDownEvent.getType();
        }

        @Override
        protected void dispatch(MouseDownHandler eventHandler) {
            eventHandler.onMouseDown(null);
        }
    });

    // Expected : true
    assertTrue(selectionEventFired[0]);
}
 
Example #7
Source File: Actions.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void fireEvent(GwtEvent<?> event) {
    if (event == null) {
        fireEvent();
        return ;
    }
    handlerManager.fireEvent(event);
}
 
Example #8
Source File: EventBus.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
public void fireEvent(GwtEvent<?> event, EventCallback callback) {
    try {
        if (!GWT.isProdMode()) {
            GWT.log("Firing " + event.toDebugString()); 
        }
        super.fireEvent(event);
        
        if (!GWT.isProdMode()) {
            GWT.log("    Event fired, calling callback"); 
        }
        callback.onEventFired();
    } catch (Exception e) {
        ExceptionHandler.handleUnexpectedException(e);
    }
}
 
Example #9
Source File: DropEventDispatcher.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
public void fireDropEvent(JQueryElement relatedTarget) {
    target.fireEvent(new GwtEvent<DropEvent.DropHandler>() {
        @Override
        public Type<DropEvent.DropHandler> getAssociatedType() {
            return DropEvent.TYPE;
        }

        @Override
        protected void dispatch(DropEvent.DropHandler handler) {
            handler.onDrop(new DropEvent(relatedTarget));
        }
    });
}
 
Example #10
Source File: DropEventDispatcher.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
public void fireDropDeactivateEvent() {
    target.fireEvent(new GwtEvent<DropDeactivateEvent.DropDeactivateHandler>() {
        @Override
        public Type<DropDeactivateEvent.DropDeactivateHandler> getAssociatedType() {
            return DropDeactivateEvent.TYPE;
        }

        @Override
        protected void dispatch(DropDeactivateEvent.DropDeactivateHandler handler) {
            handler.onDropDeactivate(new DropDeactivateEvent());
        }
    });
}
 
Example #11
Source File: DragEventDispatcher.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
public void fireDragStartEvent() {
    target.fireEvent(new GwtEvent<DragStartEvent.DragStartHandler>() {
        @Override
        public Type<DragStartEvent.DragStartHandler> getAssociatedType() {
            return DragStartEvent.TYPE;
        }

        @Override
        public void dispatch(DragStartEvent.DragStartHandler handler) {
            handler.onDragStart(new DragStartEvent());
        }
    });
}
 
Example #12
Source File: DragEventDispatcher.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
public void fireDragMoveEvent() {
    target.fireEvent(new GwtEvent<DragMoveEvent.DragMoveHandler>() {
        @Override
        public Type<DragMoveEvent.DragMoveHandler> getAssociatedType() {
            return DragMoveEvent.TYPE;
        }

        @Override
        public void dispatch(DragMoveEvent.DragMoveHandler handler) {
            handler.onDragMove(new DragMoveEvent());
        }
    });
}
 
Example #13
Source File: DragEventDispatcher.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
public void fireDragEndEvent() {
    target.fireEvent(new GwtEvent<DragEndEvent.DragEndHandler>() {
        @Override
        public Type<DragEndEvent.DragEndHandler> getAssociatedType() {
            return DragEndEvent.TYPE;
        }

        @Override
        public void dispatch(DragEndEvent.DragEndHandler handler) {
            handler.onDragEnd(new DragEndEvent());
        }
    });
}
 
Example #14
Source File: DragEventDispatcher.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
public void fireDragEnterEvent(JQueryElement relatedTarget) {
    target.fireEvent(new GwtEvent<DragEnterEvent.DragEnterHandler>() {
        @Override
        public Type<DragEnterEvent.DragEnterHandler> getAssociatedType() {
            return DragEnterEvent.TYPE;
        }

        @Override
        protected void dispatch(DragEnterEvent.DragEnterHandler handler) {
            handler.onDragEnter(new DragEnterEvent(relatedTarget));
        }
    });
}
 
Example #15
Source File: DragEventDispatcher.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
public void fireDragLeaveEvent(JQueryElement relatedTarget) {
    target.fireEvent(new GwtEvent<DragLeaveEvent.DragLeaveHandler>() {
        @Override
        public Type<DragLeaveEvent.DragLeaveHandler> getAssociatedType() {
            return DragLeaveEvent.TYPE;
        }

        @Override
        protected void dispatch(DragLeaveEvent.DragLeaveHandler handler) {
            handler.onDragLeave(new DragLeaveEvent(relatedTarget));
        }
    });
}
 
Example #16
Source File: ClientEvents.java    From incubator-retired-wave with Apache License 2.0 4 votes vote down vote up
public void fireEvent(GwtEvent<?> event) {
  handlerManager.fireEvent(event);
}
 
Example #17
Source File: WaveCreationEvent.java    From incubator-retired-wave with Apache License 2.0 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.GwtEvent.Type<WaveCreationEventHandler> getAssociatedType() {
  return TYPE;
}
 
Example #18
Source File: TableOrder.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void fireEvent(GwtEvent<?> event) {
	EventBus.get().fireEvent(event);
}
 
Example #19
Source File: TableSelecter.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void fireEvent(GwtEvent<?> event) {
	if (this.handlerManager != null) {
		this.handlerManager.fireEvent(event);
	}
}
 
Example #20
Source File: LiveValueChangeEvent.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public GwtEvent.Type<Handler> getAssociatedType() {
	return LiveValueChangeEvent.TYPE;
}
 
Example #21
Source File: CollapseEvent.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public GwtEvent.Type<Handler> getAssociatedType() {
	return CollapseEvent.TYPE;
}
 
Example #22
Source File: CellTreeNodeView.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void fireEvent(GwtEvent<?> event) {
  handlerManger.fireEvent(event);
}
 
Example #23
Source File: CachedEvent.java    From gwt-appcache with Apache License 2.0 4 votes vote down vote up
public static GwtEvent.Type<Handler> getType()
{
  return TYPE;
}
 
Example #24
Source File: CachedEvent.java    From gwt-appcache with Apache License 2.0 4 votes vote down vote up
@Override
public GwtEvent.Type<Handler> getAssociatedType()
{
  return CachedEvent.getType();
}
 
Example #25
Source File: ProgressEvent.java    From gwt-appcache with Apache License 2.0 4 votes vote down vote up
public static GwtEvent.Type<Handler> getType()
{
  return TYPE;
}
 
Example #26
Source File: ProgressEvent.java    From gwt-appcache with Apache License 2.0 4 votes vote down vote up
@Override
public GwtEvent.Type<Handler> getAssociatedType()
{
  return ProgressEvent.getType();
}
 
Example #27
Source File: ErrorEvent.java    From gwt-appcache with Apache License 2.0 4 votes vote down vote up
public static GwtEvent.Type<Handler> getType()
{
  return TYPE;
}
 
Example #28
Source File: ObsoleteEvent.java    From gwt-appcache with Apache License 2.0 4 votes vote down vote up
public static GwtEvent.Type<Handler> getType()
{
  return TYPE;
}
 
Example #29
Source File: ObsoleteEvent.java    From gwt-appcache with Apache License 2.0 4 votes vote down vote up
@Override
public GwtEvent.Type<Handler> getAssociatedType()
{
  return ObsoleteEvent.getType();
}
 
Example #30
Source File: DebugMessageEvent.java    From incubator-retired-wave with Apache License 2.0 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.GwtEvent.Type<DebugMessageEventHandler> getAssociatedType() {
  return TYPE;
}