Package com.google.gdt.eclipse.designer.model.widgets.menu

Examples of com.google.gdt.eclipse.designer.model.widgets.menu.MenuBarInfo$MenuAbstractImpl


        "    RootPanel rootPanel = RootPanel.get();",
        "    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));
    policy.commandCreate(newItem, null);
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootPanel rootPanel = RootPanel.get();",
        "    MenuBar bar = new MenuBar();",
        "    rootPanel.add(bar);",
        "    {",
        "      MenuBar menuBar = new MenuBar(true);",
        "      MenuItem menuItem = new MenuItem('New menu', false, menuBar);",
        "      bar.addItem(menuItem);",
        "    }",
        "  }",
        "}");
    assertHierarchy(
        "{RootPanel.get()} {local-unique: rootPanel} {/RootPanel.get()/ /rootPanel.add(bar)/}",
        "  {new: com.google.gwt.user.client.ui.MenuBar} {local-unique: bar} {/new MenuBar()/ /rootPanel.add(bar)/ /bar.addItem(menuItem)/}",
        "    {new: com.google.gwt.user.client.ui.MenuItem withSubMenu} {local-unique: menuItem} {/new MenuItem('New menu', false, menuBar)/ /bar.addItem(menuItem)/}",
        "      {new: com.google.gwt.user.client.ui.MenuBar vertical} {local-unique: menuBar} {/new MenuBar(true)/ /new MenuItem('New menu', false, menuBar)/}");
    {
      MenuBarInfo subMenu = newItem.getSubMenu();
      Association association = subMenu.getAssociation();
      assertInstanceOf(ConstructorChildAssociation.class, association);
      assertEquals("new MenuItem(\"New menu\", false, menuBar)", association.getSource());
      assertSame(subMenu, association.getJavaInfo());
    }
  }
View Full Code Here


            "      rootPanel.add(button);",
            "    }",
            "  }",
            "}");
    refresh();
    MenuBarInfo bar = getJavaInfoByName("bar");
    WidgetInfo button = frame.getChildrenWidgets().get(1);
    // validate
    IMenuPolicy policy = MenuObjectInfoUtils.getMenuInfo(bar).getPolicy();
    // Object can not be pasted (not list of memento at all)
    assertFalse(policy.validatePaste(new Object()));
View Full Code Here

        "      bar.addItem(existingItem);",
        "    }",
        "  }",
        "}");
    refresh();
    MenuBarInfo bar = getJavaInfoByName("bar");
    // create new item
    List<JavaInfoMemento> mementos;
    {
      MenuItemInfo existingItem = bar.getItems().get(0);
      JavaInfoMemento memento = JavaInfoMemento.createMemento(existingItem);
      mementos = ImmutableList.of(memento);
    }
    // paste "newItem"
    {
View Full Code Here

        "  {new: com.google.gwt.user.client.ui.MenuBar} {local-unique: bar} {/new MenuBar()/ /rootPanel.add(bar)/ /bar.addItem('A', subMenu_1)/ /bar.addItem('B', subMenu_2)/}",
        "    {implicit-factory} {empty} {/bar.addItem('A', subMenu_1)/}",
        "      {new: com.google.gwt.user.client.ui.MenuBar} {local-unique: subMenu_1} {/new MenuBar(false)/ /bar.addItem('A', subMenu_1)/}",
        "    {implicit-factory} {empty} {/bar.addItem('B', subMenu_2)/}",
        "      {new: com.google.gwt.user.client.ui.MenuBar} {local-unique: subMenu_2} {/new MenuBar(false)/ /bar.addItem('B', subMenu_2)/}");
    MenuBarInfo bar = getJavaInfoByName("bar");
    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"
    {
View Full Code Here

        "{RootPanel.get()} {local-unique: rootPanel} {/RootPanel.get()/ /rootPanel.add(bar)/}",
        "  {new: com.google.gwt.user.client.ui.MenuBar} {local-unique: bar} {/new MenuBar()/ /rootPanel.add(bar)/ /bar.addItem('A', subMenu)/ /bar.addItem(menuItem)/}",
        "    {implicit-factory} {empty} {/bar.addItem('A', subMenu)/}",
        "      {new: com.google.gwt.user.client.ui.MenuBar} {local-unique: subMenu} {/new MenuBar(false)/ /bar.addItem('A', subMenu)/}",
        "    {new: com.google.gwt.user.client.ui.MenuItem} {local-unique: menuItem} {/new MenuItem('Some item', (Command) null)/ /bar.addItem(menuItem)/}");
    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(
View Full Code Here

        "      MenuItem menuItem = new MenuItem('B', (Command) null);",
        "      bar.addItem(menuItem);",
        "    }",
        "  }",
        "}");
    MenuBarInfo bar = getJavaInfoByName("bar");
    MenuItemInfo item = bar.getItems().get(0);
    //
    IMenuManager contextMenu = getContextMenu(item);
    List<IAction> actions = findChildActions(contextMenu, "Open Command");
    assertThat(actions).hasSize(1);
  }
View Full Code Here

            "      });",
            "    }",
            "  }",
            "}");
    refresh();
    MenuBarInfo bar = getJavaInfoByName("bar");
    final MenuItemInfo item = bar.getItems().get(0);
    //
    {
      RunnableEx runnable = new RunnableEx() {
        public void run() throws Exception {
          item.openCommand();
View Full Code Here

            "      bar.addItem(menuItem);",
            "    }",
            "  }",
            "}");
    refresh();
    MenuBarInfo bar = getJavaInfoByName("bar");
    final MenuItemInfo item = bar.getItems().get(0);
    //
    {
      RunnableEx runnable = new RunnableEx() {
        public void run() throws Exception {
          item.openCommand();
View Full Code Here

            "      bar.addItem(menuItem);",
            "    }",
            "  }",
            "}");
    refresh();
    MenuBarInfo bar = getJavaInfoByName("bar");
    final MenuItemInfo item = bar.getItems().get(0);
    //
    RunnableEx runnable = new RunnableEx() {
      public void run() throws Exception {
        IAction action = findChildAction(getContextMenu(item), "Open Command");
        assertNotNull(action);
View Full Code Here

            "      bar.addItem(menuItem);",
            "    }",
            "  }",
            "}");
    refresh();
    MenuBarInfo bar = getJavaInfoByName("bar");
    MenuItemInfo item = bar.getItems().get(0);
    // set mock for DesignPageSite
    IDesignPageSite pageSite;
    Capture<Integer> openSourcePosition = new Capture<Integer>();
    {
      pageSite = EasyMock.createStrictMock(IDesignPageSite.class);
View Full Code Here

TOP

Related Classes of com.google.gdt.eclipse.designer.model.widgets.menu.MenuBarInfo$MenuAbstractImpl

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.