Package org.eclipse.wb.internal.core.model.menu

Examples of org.eclipse.wb.internal.core.model.menu.IMenuInfo


    assertThat(bar.getAllItems()).containsOnly(separator);
    // IMenuItemInfo
    {
      IMenuItemInfo separatorObject;
      {
        IMenuInfo barObject = MenuObjectInfoUtils.getMenuInfo(bar);
        List<IMenuItemInfo> items = barObject.getItems();
        assertThat(items).hasSize(1);
        separatorObject = items.get(0);
      }
      // ask IMenuItemInfo directly
      assertNull(separator.getAdapter(List.class));
View Full Code Here


      assertNull(menu.getAdapter(List.class));
      assertNull(item_1.getAdapter(List.class));
    }
    // IMenuInfo
    {
      IMenuInfo menuObject = MenuObjectInfoUtils.getMenuInfo(menu);
      assertSame(menu, menuObject.getModel());
      // presentation
      {
        // no need for image, because this MenuBar is visible on usual screen shot
        assertNull(menuObject.getImage());
        // some reasonable bounds
        {
          Rectangle bounds = menuObject.getBounds();
          assertThat(bounds.x).isEqualTo(0);
          assertThat(bounds.y).isEqualTo(0);
          assertThat(bounds.width).isGreaterThan(30);
          assertThat(bounds.height).isGreaterThan(20);
        }
      }
      // access
      assertTrue(menuObject.isHorizontal());
      {
        List<IMenuItemInfo> itemObjects = menuObject.getItems();
        assertThat(itemObjects).hasSize(2);
        // "Sub" item
        {
          IMenuItemInfo itemObject = itemObjects.get(0);
          assertSame(item_1, itemObject.getModel());
          // presentation
          {
            // items don't have screen shot, we show them on menu shots
            assertNull(itemObject.getImage());
            // reasonable bounds
            {
              Rectangle bounds = itemObject.getBounds();
              assertThat(bounds.x).isEqualTo(2);
              assertThat(bounds.y).isEqualTo(2);
              assertThat(bounds.width).isGreaterThan(30);
              assertThat(bounds.height).isGreaterThan(20);
            }
          }
          // sub-menu
          {
            IMenuInfo subMenuObject = itemObject.getMenu();
            assertSame(subMenu, subMenuObject.getModel());
            // access
            assertFalse(subMenuObject.isHorizontal());
            {
              List<IMenuItemInfo> subMenuItemObjects = subMenuObject.getItems();
              assertThat(subMenuItemObjects).hasSize(2);
              assertSame(subMenuItem_1, subMenuItemObjects.get(0).getModel());
              assertSame(subMenuItem_2, subMenuItemObjects.get(1).getModel());
            }
            // presentation
            assertNotNull(subMenuObject.getImage());
            {
              Rectangle bounds = subMenuObject.getBounds();
              assertThat(bounds.width).isGreaterThan(85);
              assertThat(bounds.height).isGreaterThan(45);
            }
          }
        }
View Full Code Here

        "  <g:FlowPanel>",
        "    <g:MenuBar wbp:name='bar'/>",
        "  </g:FlowPanel>",
        "</ui:UiBinder>");
    MenuBarInfo bar = getObjectByName("bar");
    IMenuInfo barObject = MenuObjectInfoUtils.getMenuInfo(bar);
    IMenuPolicy barPolicy = barObject.getPolicy();
    // don't accept something other than MenuItem or MenuItemSeparator
    assertFalse(barPolicy.validateCreate(new Object()));
    // create new MenuItemSeparator
    MenuItemSeparatorInfo newSeparator =
        createObject("com.google.gwt.user.client.ui.MenuItemSeparator");
View Full Code Here

        "    </g:MenuBar>",
        "  </g:FlowPanel>",
        "</ui:UiBinder>");
    MenuBarInfo bar = getObjectByName("bar");
    MenuItemSeparatorInfo separator = getObjectByName("separator");
    IMenuInfo barObject = MenuObjectInfoUtils.getMenuInfo(bar);
    IMenuPolicy barPolicy = barObject.getPolicy();
    // don't accept something other than MenuItem or MenuItemSeparator
    assertFalse(barPolicy.validateMove(new Object()));
    assertTrue(barPolicy.validateMove(separator));
    barPolicy.commandMove(separator, null);
    assertXML(
View Full Code Here

        "  <g:FlowPanel>",
        "    <g:MenuBar wbp:name='bar'/>",
        "  </g:FlowPanel>",
        "</ui:UiBinder>");
    MenuBarInfo bar = getObjectByName("bar");
    IMenuInfo barObject = MenuObjectInfoUtils.getMenuInfo(bar);
    IMenuPolicy policy = barObject.getPolicy();
    // don't accept something other than MenuItem
    assertFalse(policy.validateCreate(new Object()));
    // create new MenuItem
    MenuItemInfo newItem = createObject("com.google.gwt.user.client.ui.MenuItem");
    assertTrue(policy.validateCreate(newItem));
View Full Code Here

    MenuItemInfo item_1 = getObjectByName("item_1");
    MenuItemInfo item_2 = getObjectByName("item_2");
    // can not move "bar" on "subMenu_1"
    {
      MenuBarInfo subMenu_1 = item_1.getSubMenu();
      IMenuInfo subMenuObject_1 = MenuObjectInfoUtils.getMenuInfo(subMenu_1);
      assertFalse(subMenuObject_1.getPolicy().validateMove(bar));
    }
    // move "item_2" before "item_1"
    {
      IMenuPolicy policy = MenuObjectInfoUtils.getMenuInfo(bar).getPolicy();
      // validate
View Full Code Here

        "      <g:MenuBar wbp:name='subMenu'>",
        "    <g:MenuItem wbp:name='separateItem' text='B'>");
    MenuBarInfo subMenu = getObjectByName("subMenu");
    MenuItemInfo separateItem = getObjectByName("separateItem");
    // can reparent "separateItem" to "subMenu"
    IMenuInfo subMenuObject = MenuObjectInfoUtils.getMenuInfo(subMenu);
    assertTrue(subMenuObject.getPolicy().validateMove(separateItem));
    subMenuObject.getPolicy().commandMove(separateItem, null);
    assertXML(
        "// filler filler filler filler filler",
        "// filler filler filler filler filler",
        "<ui:UiBinder>",
        "  <g:FlowPanel>",
View Full Code Here

    assertThat(bar.getAllItems()).containsOnly(separator);
    // IMenuItemInfo
    {
      IMenuItemInfo separatorObject;
      {
        IMenuInfo barObject = MenuObjectInfoUtils.getMenuInfo(bar);
        List<IMenuItemInfo> items = barObject.getItems();
        assertThat(items).hasSize(1);
        separatorObject = items.get(0);
      }
      // ask IMenuItemInfo directly
      assertNull(separator.getAdapter(List.class));
View Full Code Here

      assertNull(menu.getAdapter(List.class));
      assertNull(item_1.getAdapter(List.class));
    }
    // IMenuInfo
    {
      IMenuInfo menuObject = MenuObjectInfoUtils.getMenuInfo(menu);
      assertSame(menu, menuObject.getModel());
      // presentation
      {
        // no need for image, because this MenuBar is visible on usual screen shot
        assertNull(menuObject.getImage());
        // some reasonable bounds
        {
          Rectangle bounds = menuObject.getBounds();
          assertThat(bounds.x).isEqualTo(10);
          assertThat(bounds.y).isEqualTo(10);
          assertThat(bounds.width).isGreaterThan(30);
          assertThat(bounds.height).isGreaterThan(20);
        }
      }
      // access
      assertTrue(menuObject.isHorizontal());
      {
        List<IMenuItemInfo> itemObjects = menuObject.getItems();
        assertThat(itemObjects).hasSize(2);
        // "Sub" item
        {
          IMenuItemInfo itemObject = itemObjects.get(0);
          assertSame(item_1, itemObject.getModel());
          // presentation
          {
            // items don't have screen shot, we show them on menu shots
            assertNull(itemObject.getImage());
            // reasonable bounds
            {
              Rectangle bounds = itemObject.getBounds();
              assertThat(bounds.x).isEqualTo(2);
              assertThat(bounds.y).isEqualTo(2);
              assertThat(bounds.width).isGreaterThan(30);
              assertThat(bounds.height).isGreaterThan(20);
            }
          }
          // sub-menu
          {
            IMenuInfo subMenuObject = itemObject.getMenu();
            assertSame(subMenu, subMenuObject.getModel());
            // access
            assertFalse(subMenuObject.isHorizontal());
            {
              List<IMenuItemInfo> subMenuItemObjects = subMenuObject.getItems();
              assertThat(subMenuItemObjects).hasSize(2);
              assertSame(subMenuItem_1, subMenuItemObjects.get(0).getModel());
              assertSame(subMenuItem_2, subMenuItemObjects.get(1).getModel());
            }
            // presentation
            assertNotNull(subMenuObject.getImage());
            {
              Rectangle bounds = subMenuObject.getBounds();
              assertThat(bounds.width).isGreaterThan(85);
              assertThat(bounds.height).isGreaterThan(45);
            }
          }
        }
View Full Code Here

        "    MenuBar bar = new MenuBar();",
        "    rootPanel.add(bar);",
        "  }",
        "}");
    MenuBarInfo bar = getJavaInfoByName("bar");
    IMenuInfo barObject = MenuObjectInfoUtils.getMenuInfo(bar);
    IMenuPolicy barPolicy = barObject.getPolicy();
    // don't accept something other than MenuItem or MenuItemSeparator
    assertFalse(barPolicy.validateCreate(new Object()));
    // create new MenuItemSeparator
    MenuItemSeparatorInfo newSeparator =
        createJavaInfo("com.google.gwt.user.client.ui.MenuItemSeparator");
View Full Code Here

TOP

Related Classes of org.eclipse.wb.internal.core.model.menu.IMenuInfo

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.