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

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


        "    }",
        "  }",
        "}");
    MenuBarInfo bar = getJavaInfoByName("bar");
    MenuItemSeparatorInfo separator = (MenuItemSeparatorInfo) bar.getAllItems().get(0);
    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);
    assertEditor(
View Full Code Here


        "    MenuBar bar = new MenuBar();",
        "    rootPanel.add(bar);",
        "  }",
        "}");
    MenuBarInfo bar = getJavaInfoByName("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 = createJavaInfo("com.google.gwt.user.client.ui.MenuItem");
    assertTrue(policy.validateCreate(newItem));
View Full Code Here

        "    MenuBar bar = new MenuBar();",
        "    rootPanel.add(bar);",
        "  }",
        "}");
    MenuBarInfo bar = getJavaInfoByName("bar");
    IMenuInfo barObject = MenuObjectInfoUtils.getMenuInfo(bar);
    IMenuPolicy policy = barObject.getPolicy();
    // prepare CreationSupport
    CreationSupport creationSupport;
    {
      String signature = "addItem(java.lang.String,boolean,com.google.gwt.user.client.Command)";
      String source = "addItem(\"New item\", false, (com.google.gwt.user.client.Command) null)";
View Full Code Here

        "    MenuBar bar = new MenuBar();",
        "    rootPanel.add(bar);",
        "  }",
        "}");
    MenuBarInfo bar = getJavaInfoByName("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 = createJavaInfo("com.google.gwt.user.client.ui.MenuItem", "withSubMenu");
    assertTrue(policy.validateCreate(newItem));
View Full Code Here

    MenuItemInfo item_1 = bar.getItems().get(0);
    MenuItemInfo item_2 = bar.getItems().get(1);
    // 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

    MenuBarInfo bar = getJavaInfoByName("bar");
    MenuItemInfo subMenuItem = bar.getItems().get(0);
    MenuItemInfo separateItem = bar.getItems().get(1);
    MenuBarInfo subMenu = subMenuItem.getSubMenu();
    // can reparent "separateItem" to "subMenu"
    IMenuInfo subMenuObject = MenuObjectInfoUtils.getMenuInfo(subMenu);
    assertTrue(subMenuObject.getPolicy().validateMove(separateItem));
    subMenuObject.getPolicy().commandMove(separateItem, null);
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootPanel rootPanel = RootPanel.get();",
        "    MenuBar bar = new MenuBar();",
View Full Code Here

    // get unsupported adaptable
    assertNull(bar.getAdapter(String.class));
    assertNull(item.getAdapter(String.class));
    // IMenuInfo
    {
      IMenuInfo barObject = MenuObjectInfoUtils.getMenuInfo(bar);
      assertSame(bar, barObject.getModel());
      assertSame(bar, barObject.getToolkitModel());
      // presentation
      {
        // no need for image, because this MenuBar is visible on usual screen shot
        assertNull(barObject.getImage());
        // some reasonable bounds
        {
          Rectangle bounds = barObject.getBounds();
          assertThat(bounds.x).isEqualTo(0);
          assertThat(bounds.y).isEqualTo(-1);
          assertThat(bounds.width).isEqualTo(450);
          assertThat(bounds.height).isGreaterThan(20);
        }
      }
      // access
      assertTrue(barObject.isHorizontal());
      {
        List<IMenuItemInfo> itemObjects = barObject.getItems();
        assertThat(itemObjects).hasSize(1);
        {
          IMenuItemInfo itemObject = itemObjects.get(0);
          assertSame(item, itemObject.getModel());
          // presentation
          {
            // no need for image, because parent MenuBar is visible on usual screen shot
            assertNull(itemObject.getImage());
            // some reasonable bounds
            {
              Rectangle bounds = itemObject.getBounds();
              assertThat(bounds.x).isEqualTo(3);
              assertThat(bounds.y).isEqualTo(3);
              assertThat(bounds.width).isGreaterThan(100);
              assertThat(bounds.height).isGreaterThan(15);
            }
          }
          // no policy
          assertSame(IMenuPolicy.NOOP, itemObject.getPolicy());
          // sub menu
          {
            IMenuInfo menuObject = itemObject.getMenu();
            assertSame(subMenu, menuObject.getModel());
          }
        }
      }
    }
  }
View Full Code Here

        "      {new: com.extjs.gxt.ui.client.widget.menu.Menu} {local-unique: menu} {/new Menu()/ /menu.add(item)/ /new MenuBarItem('MenuBarItem', menu)/}",
        "        {new: com.extjs.gxt.ui.client.widget.menu.MenuItem} {local-unique: item} {/new MenuItem('A')/ /menu.add(item)/}");
    container.refresh();
    MenuBarInfo bar = (MenuBarInfo) container.getWidgets().get(0);
    MenuInfo menu = bar.getItems().get(0).getSubMenu();
    IMenuInfo menuObject = MenuObjectInfoUtils.getMenuInfo(menu);
    ComponentInfo item = menu.getItems().get(0);
    // get unsupported adaptable
    assertNull(menu.getAdapter(String.class));
    assertSame(menu, menuObject.getModel());
    // presentation
    {
      // we should prepare image for Menu
      {
        Image image = menuObject.getImage();
        assertNotNull(image);
        org.eclipse.swt.graphics.Rectangle bounds = image.getBounds();
        assertThat(bounds.width).isEqualTo(120);
        assertThat(bounds.height).isEqualTo(30);
      }
      // some reasonable bounds
      {
        Rectangle bounds = menuObject.getBounds();
        assertThat(bounds.width).isEqualTo(120);
        assertThat(bounds.height).isEqualTo(30);
      }
    }
    // access
    assertFalse(menuObject.isHorizontal());
    // IMenuItem-s
    {
      List<IMenuItemInfo> items = menuObject.getItems();
      assertThat(items).hasSize(1);
      assertSame(item, items.get(0).getModel());
    }
  }
View Full Code Here

        assertThat(bounds.height).isEqualTo(16);
      }
    }
    // access
    {
      IMenuInfo menuObject = popupObject.getMenu();
      assertSame(MenuObjectInfoUtils.getMenuInfo(menu), menuObject);
      assertSame(menuObject, menuObject.getModel());
    }
    assertNotNull(popupObject.getPolicy());
  }
View Full Code Here

        "      {new: com.extjs.gxt.ui.client.widget.menu.Menu} {local-unique: menu} {/new Menu()/ /menu.add(button)/ /new MenuBarItem('MenuBarItem', menu)/}",
        "        {new: com.extjs.gxt.ui.client.widget.button.Button} {local-unique: button} {/new Button()/ /menu.add(button)/}");
    container.refresh();
    MenuBarInfo bar = (MenuBarInfo) container.getWidgets().get(0);
    MenuInfo menu = bar.getItems().get(0).getSubMenu();
    IMenuInfo menuObject = MenuObjectInfoUtils.getMenuInfo(menu);
    ComponentInfo button = menu.getItems().get(0);
    // IMenuItem-s
    {
      List<IMenuItemInfo> items = menuObject.getItems();
      assertThat(items).hasSize(1);
      IMenuItemInfo item = items.get(0);
      assertSame(button, item.getModel());
      // presentation
      {
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.