コード例 #1
0
ファイル: GroupingView.java プロジェクト: Elisabitao/gxt-rtl
  @Override
  protected Menu createContextMenu(final int colIndex) {
    Menu menu = super.createContextMenu(colIndex);

    if (menu != null && enableGroupingMenu && cm.isGroupable(colIndex)) {
      MenuItem groupBy = new MenuItem(GXT.MESSAGES.groupingView_groupByText());
      groupBy.setIcon(getImages().getGroupBy());
      groupBy.addSelectionListener(
          new SelectionListener<MenuEvent>() {

            @Override
            public void componentSelected(MenuEvent ce) {
              onGroupByClick(ce, colIndex);
            }
          });
      menu.add(new SeparatorMenuItem());
      menu.add(groupBy);
    }

    if (menu != null && enableGroupingMenu && enableGrouping && enableNoGroups) {
      final CheckMenuItem showInGroups =
          new CheckMenuItem(GXT.MESSAGES.groupingView_showGroupsText());
      showInGroups.setChecked(true);
      showInGroups.addSelectionListener(
          new SelectionListener<MenuEvent>() {

            @Override
            public void componentSelected(MenuEvent ce) {
              onShowGroupsClick(ce, showInGroups.isChecked());
            }
          });
      menu.add(showInGroups);
    }
    return menu;
  }
コード例 #2
0
ファイル: BaseMenuBar.java プロジェクト: dalinhuang/gwtbase
  public void _add() {
    int armStatus = ArmWrapper.FAILED;
    try {
      ArmWrapper.startTransaction(
          this, "com.base.myproject.client.ui.BaseMenuBar", "_add", new Object[] {});
      Button item1 = new Button("Button w/ Menu");
      item1.setIconStyle("icon-menu-show");
      Menu menu = new Menu();
      CheckMenuItem menuItem = new CheckMenuItem("I Like Cats");
      menuItem.setChecked(true);
      menu.add(menuItem);

      menuItem = new CheckMenuItem("I Like Dogs");
      menu.add(menuItem);
      item1.setMenu(menu);

      MenuItem menuitem2 = new MenuItem();
      menuitem2.setText("menuitem2");
      menuitem2.addSelectionListener(
          new SelectionListener() {

            @Override
            public void componentSelected(ComponentEvent ce) {
              // TODO Auto-generated method stub

            }

            public void handleEvent(BaseEvent be) {
              // TODO Auto-generated method stub
              // System.out.println("++");
              HTML homeText = new HTML("Tab you have selected is Home.");
              // BaseTabPanel.getInstance().addTab("zgw2", homeText);
              // BaseTabPanel.getInstance().addTab("zgw3", new BasePanel());
              BaseTabPanel.getInstance().addTab("zgw4", new TestBusi());
            }
          });

      menu.add(menuitem2);

      basemenubar.add(item1);
      armStatus = ArmWrapper.GOOD;
      // basemenubar.add(menuitem2);
    } finally {
      ArmWrapper.stopTransaction("com.base.myproject.client.ui.BaseMenuBar", "_add", armStatus);
    }
  }