本文整理汇总了Java中org.realityforge.gwt.webpoller.client.WebPoller类的典型用法代码示例。如果您正苦于以下问题:Java WebPoller类的具体用法?Java WebPoller怎么用?Java WebPoller使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebPoller类属于org.realityforge.gwt.webpoller.client包,在下文中一共展示了WebPoller类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MessageEvent
import org.realityforge.gwt.webpoller.client.WebPoller; //导入依赖的package包/类
public MessageEvent( @Nonnull final WebPoller webPoller,
@Nonnull final Map<String,String> context,
@Nonnull final String data )
{
super( webPoller );
_context = Collections.unmodifiableMap( context );
_data = data;
}
示例2: onMessage
import org.realityforge.gwt.webpoller.client.WebPoller; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public final void onMessage( @Nonnull final WebPoller webPoller,
@Nonnull final Map<String, String> context,
@Nonnull final String data )
{
_eventBus.fireEventFromSource( new MessageEvent( webPoller, context, data ), webPoller );
}
示例3: onModuleLoad
import org.realityforge.gwt.webpoller.client.WebPoller; //导入依赖的package包/类
public void onModuleLoad()
{
final WebPoller webPoller = WebPoller.newWebPoller();
webPoller.setRequestFactory( this );
registerListeners( webPoller );
_start = new Button( "Start", new ClickHandler()
{
@Override
public void onClick( final ClickEvent event )
{
_start.setEnabled( false );
_longPoll.setEnabled( false );
_longErrorBackOff.setEnabled( false );
webPoller.setLogLevel( Level.INFO );
webPoller.setInterRequestDuration( _longPoll.getValue() == Boolean.TRUE ? 0 : 2000 );
webPoller.setInterErrorDuration( _longErrorBackOff.getValue() == Boolean.TRUE ? 5000 : 0 );
webPoller.start();
}
} );
_stop = new Button( "Stop", new ClickHandler()
{
@Override
public void onClick( ClickEvent event )
{
webPoller.stop();
_stop.setEnabled( false );
}
} );
_stop.setEnabled( false );
_longPoll = new CheckBox( "Long Poll" );
_longErrorBackOff = new CheckBox( "Error Backoff" );
_messages = new HTML();
_scrollPanel = new ScrollPanel();
_scrollPanel.setHeight( "250px" );
_scrollPanel.add( _messages );
RootPanel.get().add( _scrollPanel );
{
final FlowPanel controls = new FlowPanel();
controls.add( _longPoll );
controls.add( _longErrorBackOff );
controls.add( _start );
controls.add( _stop );
RootPanel.get().add( controls );
}
}
示例4: WebPollerEvent
import org.realityforge.gwt.webpoller.client.WebPoller; //导入依赖的package包/类
protected WebPollerEvent( @Nonnull final WebPoller webPoller )
{
_webPoller = webPoller;
}
示例5: getWebPoller
import org.realityforge.gwt.webpoller.client.WebPoller; //导入依赖的package包/类
@Nonnull
public final WebPoller getWebPoller()
{
return _webPoller;
}
示例6: onStart
import org.realityforge.gwt.webpoller.client.WebPoller; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public final void onStart( @Nonnull final WebPoller webPoller )
{
_eventBus.fireEventFromSource( new StartEvent( webPoller ), webPoller );
}
示例7: onStop
import org.realityforge.gwt.webpoller.client.WebPoller; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public final void onStop( @Nonnull final WebPoller webPoller )
{
_eventBus.fireEventFromSource( new StopEvent( webPoller ), webPoller );
}
示例8: onError
import org.realityforge.gwt.webpoller.client.WebPoller; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public final void onError( @Nonnull final WebPoller webPoller, @Nonnull final Throwable exception )
{
_eventBus.fireEventFromSource( new ErrorEvent( webPoller, exception ), webPoller );
}
示例9: ErrorEvent
import org.realityforge.gwt.webpoller.client.WebPoller; //导入依赖的package包/类
public ErrorEvent( @Nonnull final WebPoller webPoller, @Nonnull final Throwable exception )
{
super( webPoller );
_exception = exception;
}
示例10: StartEvent
import org.realityforge.gwt.webpoller.client.WebPoller; //导入依赖的package包/类
public StartEvent( @Nonnull final WebPoller webPoller )
{
super( webPoller );
}
示例11: StopEvent
import org.realityforge.gwt.webpoller.client.WebPoller; //导入依赖的package包/类
public StopEvent( @Nonnull final WebPoller webPoller )
{
super( webPoller );
}
示例12: newWebPoller
import org.realityforge.gwt.webpoller.client.WebPoller; //导入依赖的package包/类
@Nonnull
@Override
public WebPoller newWebPoller()
{
return new TimerBasedWebPoller( _service );
}
示例13: doStart
import org.realityforge.gwt.webpoller.client.WebPoller; //导入依赖的package包/类
protected void doStart()
{
final String baseURL = getBaseURL();
switch ( getStrategy() )
{
case EVENTSOURCE:
if ( EventSource.isSupported() )
{
_eventSource = EventSource.newEventSourceIfSupported();
_eventSource.open( baseURL + "api/time" );
registerListeners( _eventSource );
}
else
{
throw new IllegalStateException( getStrategy() + " strategy not supported" );
}
break;
case WEBSOCKET:
if ( WebSocket.isSupported() )
{
_webSocket = WebSocket.newWebSocketIfSupported();
_webSocket.connect( baseURL.replaceFirst( "^http\\:", "ws:" ) + "api/wstime" );
registerListeners( _webSocket );
}
else
{
throw new IllegalStateException( getStrategy() + " strategy not supported" );
}
break;
case POLL:
{
final RequestBuilder requestBuilder = new RequestBuilder( RequestBuilder.GET, baseURL + "api/time/poll" );
_webPoller = WebPoller.newWebPoller();
_webPoller.setRequestFactory( new HttpRequestFactory( requestBuilder ) );
registerListeners( _webPoller );
_webPoller.setInterRequestDuration( 0 );
_webPoller.start();
}
break;
default:
{
throw new IllegalStateException( getStrategy() + " strategy not supported" );
}
}
if ( !isActive() )
{
throw new IllegalStateException( "Unable to initiate connection" );
}
}