Package com.eclipsesource.tabris.app

Examples of com.eclipsesource.tabris.app.App


    verify( environment.getServiceObject() ).listen( "BackNavigation", true );
  }

  @Test
  public void testAddBackNavigationListenersTransportsListenOperationOnce() {
    App app = new AppImpl();
    BackNavigationListener listener = mock( BackNavigationListener.class );
    BackNavigationListener listener2 = mock( BackNavigationListener.class );

    app.addBackNavigationListener( listener );
    app.addBackNavigationListener( listener2 );

    verify( environment.getServiceObject(), times( 1 ) ).listen( "BackNavigation", true );
  }
View Full Code Here


    verify( environment.getServiceObject(), times( 1 ) ).listen( "BackNavigation", true );
  }

  @Test
  public void testRemoveBackNavigationListensTransportsListenOperation() {
    App app = new AppImpl();
    BackNavigationListener listener = mock( BackNavigationListener.class );
    app.addBackNavigationListener( listener );

    app.removeBackNavigationListener( listener );

    RemoteObject remoteObject = environment.getServiceObject();
    InOrder order = inOrder( remoteObject );
    order.verify( remoteObject ).listen( "BackNavigation", true );
    order.verify( remoteObject ).listen( "BackNavigation", false );
View Full Code Here

    order.verify( remoteObject ).listen( "BackNavigation", false );
  }

  @Test
  public void testRemoveBackNavigationListenersTransportsListenOperationOnce() {
    App app = new AppImpl();
    BackNavigationListener listener = mock( BackNavigationListener.class );
    BackNavigationListener listener2 = mock( BackNavigationListener.class );
    app.addBackNavigationListener( listener );
    app.addBackNavigationListener( listener2 );

    app.removeBackNavigationListener( listener );
    app.removeBackNavigationListener( listener2 );

    RemoteObject remoteObject = environment.getServiceObject();
    InOrder order = inOrder( remoteObject );
    order.verify( remoteObject, times( 1 ) ).listen( "BackNavigation", true );
    order.verify( remoteObject, times( 1 ) ).listen( "BackNavigation", false );
View Full Code Here

    order.verify( remoteObject, times( 1 ) ).listen( "BackNavigation", false );
  }

  @Test
  public void testRemoveOneBackNavigationListenerDoesNotTransportsListenOperation() {
    App app = new AppImpl();
    BackNavigationListener listener = mock( BackNavigationListener.class );
    BackNavigationListener listener2 = mock( BackNavigationListener.class );
    app.addBackNavigationListener( listener );
    app.addBackNavigationListener( listener2 );

    app.removeBackNavigationListener( listener );

    RemoteObject remoteObject = environment.getServiceObject();
    InOrder order = inOrder( remoteObject );
    order.verify( remoteObject, times( 1 ) ).listen( "BackNavigation", true );
    order.verify( remoteObject, never() ).listen( "BackNavigation", false );
View Full Code Here

    shell.open();
    return 0;
  }

  private void registerAppStateListener() {
    final App app = RWT.getClient().getService( App.class );
    if( app != null ) {
      app.addEventListener( EventType.PAUSE, new AppListener() {

        public void handleEvent( AppEvent event ) {
          System.out.println("Paused");
          Label output = hal.getText();
          output.setText( "I am going to sleep now.\n" );
          output.getParent().layout( true, true );
          sleepMillis = System.currentTimeMillis();
        }
      } );
      app.addEventListener( EventType.RESUME, new AppListener() {

        public void handleEvent( AppEvent event ) {
          System.out.println("Resumed");
          long slept = ( System.currentTimeMillis() - sleepMillis ) / 1000;
          Label output = hal.getText();
          output.setText( "Good morning Dave!\n\nThank for waking me up again. I was sleeping for "
                          + slept
                          + " seconds.\n" );
          output.getParent().layout( true, true );
        }
      } );
      app.addEventListener( EventType.INACTIVE, new AppListener() {

        public void handleEvent( AppEvent event ) {
          System.out.println("Inactive");
          Label output = hal.getText();
          output.setText( "Dave, did you fall asleep?\nYou haven't touched the screen for over 10 seconds.\n" );
          output.getParent().layout( true, true );
        }
      } );
      app.startInactivityTimer( 10000 );
      app.setScreenProtection( true );
    }
  }
View Full Code Here

    Display display = new Display();
    Shell shell = new Shell( display, SWT.NO_TRIM );
    shell.setMaximized( true );
    shell.setLayout( new FillLayout() );
    ClientDevice clientDevice = RWT.getClient().getService( ClientDevice.class );
    App app = RWT.getClient().getService( App.class );
    ScrollingComposite scrollingComposite = new ScrollingComposite( shell, SWT.V_SCROLL );
    scrollingComposite.setLayout( new FillLayout() );
    createContent( clientDevice, app, scrollingComposite );
    shell.open();
    return 0;
View Full Code Here

    trackingInfo.setUserAgent( RWT.getRequest().getHeader( Constants.USER_AGENT ) );
    return trackingInfo;
  }

  private static void setAppInfo( TrackingInfo trackingInfo ) {
    App app = RWT.getClient().getService( App.class );
    if( app != null ) {
      trackingInfo.setTabrisVersion( app.getTabrisVersion() );
      trackingInfo.setAppId( app.getId() );
      trackingInfo.setAppVersion( app.getVersion() );
    }
  }
View Full Code Here

TOP

Related Classes of com.eclipsesource.tabris.app.App

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.