Package com.foreach.across.modules.web.menu

Examples of com.foreach.across.modules.web.menu.Menu.addItem()


    Menu item = menu.addItem( "path2" );
    item.addItem( "sub1" );
    Menu subItem = item.addItem( "sub2" );

    subItem.addItem( "subsub1" ).setSelected( true );
    subItem.addItem( "subsub2" );

    menu.getItemWithPath( "sub1" ).setSelected( true );

    assertFalse( menu.getItemWithPath( "path1" ).isSelected() );
    assertTrue( menu.getItemWithPath( "path2" ).isSelected() );
View Full Code Here


  }

  @Test
  public void selectedItemIsAlwaysLookedForInTheSubtree() {
    Menu menu = new Menu();
    menu.addItem( "path1" );

    Menu item = menu.addItem( "path2" );
    item.addItem( "sub1" );
    Menu subItem = item.addItem( "sub2" );
View Full Code Here

  public void selectedItemIsAlwaysLookedForInTheSubtree() {
    Menu menu = new Menu();
    menu.addItem( "path1" );

    Menu item = menu.addItem( "path2" );
    item.addItem( "sub1" );
    Menu subItem = item.addItem( "sub2" );

    subItem.addItem( "subsub1" ).setSelected( true );
    subItem.addItem( "subsub2" );
View Full Code Here

    Menu item = menu.addItem( "path2" );
    item.addItem( "sub1" );
    Menu subItem = item.addItem( "sub2" );

    subItem.addItem( "subsub1" ).setSelected( true );
    subItem.addItem( "subsub2" );

    Menu selected = menu.getSelectedItem();
    assertSame( item, selected );
View Full Code Here

    Menu item = menu.addItem( "path2" );
    item.addItem( "sub1" );
    Menu subItem = item.addItem( "sub2" );

    subItem.addItem( "subsub1" ).setSelected( true );
    subItem.addItem( "subsub2" );

    Menu selected = menu.getSelectedItem();
    assertSame( item, selected );

    selected = menu.getLowestSelectedItem();
View Full Code Here

  }

  @Test
  public void selectedItemPathIfNoneSelected() {
    Menu menu = new Menu();
    menu.addItem( "one" );

    assertNull( menu.getSelectedItem() );
    assertTrue( menu.getSelectedItemPath().isEmpty() );
  }
View Full Code Here

  }

  @Test
  public void selectedItemPathIfRootSelected() {
    Menu menu = new Menu();
    menu.addItem( "one" );

    menu.setSelected( true );

    assertNull( menu.getSelectedItem() );
    List<Menu> items = menu.getSelectedItemPath();
View Full Code Here

  @Test
  public void selectedItemPathIfLowerSelected() {
    Menu menu = new Menu();
    Menu item = menu.addItem( "one" );
    item.addItem( "sub-one" );
    Menu subTwo = item.addItem( "sub-two" );

    subTwo.setSelected( true );

    List<Menu> items = menu.getSelectedItemPath();
View Full Code Here

  public void mergeMenu() {
    @SuppressWarnings("unchecked")
    Comparator<Menu> mockComparator = mock( Comparator.class );

    Menu menu = new Menu();
    menu.addItem( "path1" );

    Menu item = menu.addItem( "path2" );
    item.setAttribute( "myattribute", "myvalue" );
    item.setAttribute( "myattribute2", "myvalue" );
View Full Code Here

  public void orderedMenuIsNotSorted() {
    Menu menu = new Menu( "any" );
    menu.setOrdered( true );
    menu.addItem( "/aaa", "ccc" );
    menu.addItem( "/bbb", "aaa" );
    menu.addItem( "/ccc", "bbb" );

    menu.sort();

    assertMenu( menu, "ccc", "aaa", "bbb" );
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.