Package com.eclipsesource.tabris.ui

Examples of com.eclipsesource.tabris.ui.ActionConfiguration


  @Test
  public void testAddAction() {
    PageDescriptor descriptor = new PageDescriptor( "foo", TestPage.class );

    descriptor.addAction( new ActionConfiguration( "foo", TestAction.class ) );

    List<ActionDescriptor> actions = descriptor.getActions();
    assertEquals( 1, actions.size() );
    ActionDescriptor actionDescriptor = actions.get( 0 );
    assertEquals( "foo", actionDescriptor.getId() );
View Full Code Here


  @Test
  public void testAddActionReturnsDescriptor() {
    PageDescriptor descriptor = new PageDescriptor( "foo", TestPage.class );

    PageDescriptor actualDescriptor = descriptor.addAction( new ActionConfiguration( "foo", TestAction.class ) );

    assertSame( descriptor, actualDescriptor );
  }
View Full Code Here

  private UIImpl createUI( Class<? extends AbstractPage> pageType) {
    UIConfiguration configuration = new UIConfiguration();
    Shell shell = new Shell( new Display() );
    shell.setLayout( new ZIndexStackLayout() );
    ActionConfiguration actionConfiguration = new ActionConfiguration( "bar", TestAction.class );
    configuration.addPageConfiguration( new PageConfiguration( "fooRoot", TestPage.class ).setTopLevel( true ) );
    configuration.addPageConfiguration( new PageConfiguration( "foo", pageType )
      .addActionConfiguration( actionConfiguration ) );
    RemoteUI remoteUI = new RemoteUI( shell );
    Controller controller = new Controller( remoteUI, configuration.getAdapter( UIDescriptor.class ) );
View Full Code Here

  @Test
  public void testHasPageAction() {
    PageDescriptor pageDescriptor = new PageDescriptor( "bar", TestPage.class );
    pageDescriptor.setTopLevel( true );
    pageDescriptor.addAction( new ActionConfiguration( "foo", TestAction.class ) );
    uiDescriptor.add( pageDescriptor );
    RemoteUI remoteUI = mock( RemoteUI.class );
    when( remoteUI.getPageParent() ).thenReturn( shell );
    Controller controller = new Controller( remoteUI, uiDescriptor );
    controller.createGlobalActions( ui );
View Full Code Here

  @Test
  public void testCanGetActionConfigurationForGlobalAction() {
    UIConfiguration configuration = new UIConfiguration();
    PageConfiguration pageConfiguration = new PageConfiguration( "foo", TestPage.class ).setTopLevel( true );
    configuration.addPageConfiguration( pageConfiguration );
    ActionConfiguration actionConfiguration = new ActionConfiguration( "bar", TestAction.class );
    configuration.addActionConfiguration( actionConfiguration );
    UIDescriptor uiDescriptor = configuration.getAdapter( UIDescriptor.class );
    Controller controller = new Controller( new RemoteUI( shell ), uiDescriptor );
    UIImpl ui = new UIImpl( shell.getDisplay(), controller, configuration );
    controller.setUI( ui );
    controller.createRootPages( ui );
    controller.createGlobalActions( ui );

    ActionConfiguration actualConfiguration = controller.getActionConfiguration( uiDescriptor.getActionDescriptor( "bar" ).getAction() );

    assertSame( actionConfiguration, actualConfiguration );
  }
View Full Code Here

    UIConfiguration configuration = new UIConfiguration();
    PageConfiguration pageConfiguration = new PageConfiguration( "foo", TestPage.class ).setTopLevel( true );
    PageConfiguration pageConfiguration2 = new PageConfiguration( "foo2", TestPage.class );
    configuration.addPageConfiguration( pageConfiguration );
    configuration.addPageConfiguration( pageConfiguration2 );
    ActionConfiguration actionConfiguration = new ActionConfiguration( "bar", TestAction.class );
    pageConfiguration2.addActionConfiguration( actionConfiguration );
    UIDescriptor uiDescriptor = configuration.getAdapter( UIDescriptor.class );
    Controller controller = new Controller( new RemoteUI( shell ), uiDescriptor );
    UIImpl ui = new UIImpl( shell.getDisplay(), controller, configuration );
    controller.setUI( ui );
    controller.createRootPages( ui );
    controller.createGlobalActions( ui );
    PageRenderer page = controller.showPage( ui, pageConfiguration2.getAdapter( PageDescriptor.class ), new PageData() );
    Action action = page.getActionRenderers().get( 0 ).getDescriptor().getAction();

    ActionConfiguration actualConfiguration = controller.getActionConfiguration( action );

    assertSame( actionConfiguration, actualConfiguration );
  }
View Full Code Here

    UIImpl ui = new UIImpl( shell.getDisplay(), controller, configuration );
    controller.setUI( ui );
    controller.createRootPages( ui );
    controller.createGlobalActions( ui );

    ActionConfiguration actualConfiguration = controller.getActionConfiguration( mock( Action.class ) );

    assertNull( actualConfiguration );
  }
View Full Code Here

  @Test
  public void testDispatchesActionExecution() {
    EventDispatcher dispatcher = mock( EventDispatcher.class );
    Tracking tracking = new Tracking( dispatcher, new ArrayList<Tracker>() );
    ActionConfiguration actionConfiguration = mock( ActionConfiguration.class );
    when( actionConfiguration.getId() ).thenReturn( "bar" );
    UIConfiguration configuration = mock( UIConfiguration.class );

    tracking.attach( configuration );
    fakeActionExecution( configuration, actionConfiguration );
View Full Code Here

  @Test
  public void testDispatchesSearch() {
    EventDispatcher dispatcher = mock( EventDispatcher.class );
    Tracking tracking = new Tracking( dispatcher, new ArrayList<Tracker>() );
    ActionConfiguration actionConfiguration = mock( ActionConfiguration.class );
    when( actionConfiguration.getId() ).thenReturn( "bar" );
    UIConfiguration configuration = mock( UIConfiguration.class );

    tracking.attach( configuration );
    fakeSearch( configuration, actionConfiguration, "foo" );
View Full Code Here

  private void createBookDetailsPage( UIConfiguration configuration ) {
    PageConfiguration page = new PageConfiguration( BookDetailsPage.class.getName(),
                                                    BookDetailsPage.class );
    page.setTitle( "Book" );
    ActionConfiguration action = new ActionConfiguration( ShareAction.class.getName(),
                                                          ShareAction.class );
    action.setImage( getImage( IMAGE_ACTION_SHARE ) );
    action.setTitle( "Share" );
    page.addActionConfiguration( action );
    configuration.addPageConfiguration( page );
  }
View Full Code Here

TOP

Related Classes of com.eclipsesource.tabris.ui.ActionConfiguration

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.