Package org.uberfire.workbench.model.menu

Examples of org.uberfire.workbench.model.menu.Menus


    }

    private void setupMenu() {
        final AbstractWorkbenchPerspectiveActivity defaultPerspective = getDefaultPerspectiveActivity();

        final Menus menus = MenuFactory
                .newTopLevelMenu( "Home" )
                .respondsWith( new Command() {
                    @Override
                    public void execute() {
                        if ( defaultPerspective != null ) {
View Full Code Here


    }

    private void setupMenu() {
        final AbstractWorkbenchPerspectiveActivity defaultPerspective = getDefaultPerspectiveActivity();

        final Menus menus = MenuFactory
                .newTopLevelMenu( "Home" )
                .respondsWith( new Command() {
                    @Override
                    public void execute() {
                        if ( defaultPerspective != null ) {
View Full Code Here

    }

    private void setupMenu() {
        final AbstractWorkbenchPerspectiveActivity defaultPerspective = getDefaultPerspectiveActivity();

        final Menus menus = MenuFactory
                .newTopLevelMenu( "Home" )
                .respondsWith( new Command() {
                    @Override
                    public void execute() {
                        if ( defaultPerspective != null ) {
View Full Code Here

    }

    private void setupMenu() {
        final AbstractWorkbenchPerspectiveActivity defaultPerspective = getDefaultPerspectiveActivity();

        final Menus menus = MenuFactory
                .newTopLevelMenu( "Home" )
                .respondsWith( new Command() {
                    @Override
                    public void execute() {
                        if ( defaultPerspective != null ) {
View Full Code Here

    @Override
    public Menus build() {

        context.clear();

        return new Menus() {
            @Override
            public List<MenuItem> getItems() {
                return unmodifiableList( menuItems );
            }
View Full Code Here

        compass.onDrop( context );

        //Move Part from source to target
        final WorkbenchDragContext workbenchContext = dndManager.getWorkbenchContext();
        final Menus menus = workbenchContext.getMenus();



        final PanelDefinition sourcePanel = workbenchContext.getSourcePanel();
        final PanelDefinition dropPanel = dropTarget.getPresenter().getDefinition();
View Full Code Here

    }

    private void setupMenu( @Observes final ApplicationReadyEvent event ) {
        final PerspectiveActivity defaultPerspective = getDefaultPerspectiveActivity();

        final Menus menus =
                newTopLevelMenu( "Home" )
                        .respondsWith( new Command() {
                            @Override
                            public void execute() {
                                if ( defaultPerspective != null ) {
View Full Code Here

        }
    };

    @Test
    public void testSimpleMenu() {
        final Menus menus = newTopLevelMenu( "File" )
                        .position( MenuPosition.RIGHT )
                        .menus()
                            .menu( "Save" )
                               .order( 2 )
                               .respondsWith( DUMMY )
                            .endMenu()
                            .menu( "Close" )
                                .respondsWith( DUMMY )
                            .endMenu()
                        .endMenus()
                    .endMenu().build();

        final Menus custom = newTopLevelMenu( "X" )
                .custom( new CustomMenuBuilder() {
                    @Override
                    public void push( CustomMenuBuilder element ) {
                    }
View Full Code Here

        }
    }

    @Test
    public void testSimpleNestedMenu() {
        final Menus menus = newTopLevelMenu( "File" )
                        .menus()
                            .menu( "Operations" )
                                .menus()
                                    .menu( "Save" )
                                        .respondsWith( DUMMY )
                                    .endMenu()
                                    .menu( "Close" )
                                        .respondsWith( DUMMY )
                                    .endMenu()
                                .endMenus()
                            .endMenu()
                        .endMenus()
                    .endMenu()
                    .newTopLevelMenu( "Explore" )
                        .respondsWith( DUMMY )
                    .endMenu()
                    .build();

        assertThat( menus ).isNotNull();
        assertThat( menus.getItems() ).isNotNull().hasSize( 2 );
        {
            assertThat( menus.getItems().get( 0 ) ).isNotNull();
            assertThat( menus.getItems().get( 0 ) ).isInstanceOf( MenuGroup.class );
            assertThat( menus.getItems().get( 0 ).getCaption() ).isEqualTo( "File" );
            assertThat( ((MenuGroup) menus.getItems().get( 0 )).getItems() ).hasSize( 1 );

            {
                final MenuItem menuItem = ((MenuGroup) menus.getItems().get( 0 )).getItems().get( 0 );
                assertThat( menuItem ).isNotNull();
                assertThat( menuItem.getCaption() ).isEqualTo( "Operations" );
                assertThat( menuItem ).isInstanceOf( MenuGroup.class );

                {
                    final MenuItem subMenuItem = ((MenuGroup) menuItem).getItems().get( 0 );
                    assertThat( subMenuItem ).isNotNull();
                    assertThat( subMenuItem.getCaption() ).isEqualTo( "Save" );
                }

                {
                    final MenuItem subMenuItem = ((MenuGroup) menuItem).getItems().get( 1 );
                    assertThat( subMenuItem ).isNotNull();
                    assertThat( subMenuItem.getCaption() ).isEqualTo( "Close" );
                }
            }

            assertThat( menus.getItems().get( 1 ) ).isNotNull();
            assertThat( menus.getItems().get( 1 ) ).isInstanceOf( MenuItemCommand.class );
            assertThat( menus.getItems().get( 1 ).getCaption() ).isEqualTo( "Explore" );
        }
    }
View Full Code Here

    }

    private void setupMenu( @Observes final ApplicationReadyEvent event ) {
        final PerspectiveActivity defaultPerspective = getDefaultPerspectiveActivity();

        final Menus menus =
                newTopLevelMenu( "Home" )
                        .respondsWith( new Command() {
                            @Override
                            public void execute() {
                                if ( defaultPerspective != null ) {
View Full Code Here

TOP

Related Classes of org.uberfire.workbench.model.menu.Menus

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.