Package com.sencha.gxt.widget.core.client.menu

Examples of com.sencha.gxt.widget.core.client.menu.Menu$MenuAppearance


    w.setVisible(false);
  }

  protected void initMore() {
    if (more == null) {
      moreMenu = new Menu();
      moreMenu.addBeforeShowHandler(new BeforeShowHandler() {

        @Override
        public void onBeforeShow(BeforeShowEvent event) {
          clearMenu();
View Full Code Here


   *
   * @param colIndex the column index
   * @return the context menu for the given column
   */
  protected Menu createContextMenu(final int colIndex) {
    final Menu menu = new Menu();

    if (cm.isSortable(colIndex)) {
      MenuItem item = new MenuItem();
      item.setText(DefaultMessages.getMessages().gridView_sortAscText());
      item.setIcon(header.getAppearance().sortAscendingIcon());
      item.addSelectionHandler(new SelectionHandler<Item>() {

        @Override
        public void onSelection(SelectionEvent<Item> event) {
          doSort(colIndex, SortDir.ASC);

        }
      });
      menu.add(item);

      item = new MenuItem();
      item.setText(DefaultMessages.getMessages().gridView_sortDescText());
      item.setIcon(header.getAppearance().sortDescendingIcon());
      item.addSelectionHandler(new SelectionHandler<Item>() {

        @Override
        public void onSelection(SelectionEvent<Item> event) {
          doSort(colIndex, SortDir.DESC);

        }
      });
      menu.add(item);
    }

    MenuItem columns = new MenuItem();
    columns.setText(DefaultMessages.getMessages().gridView_columnsText());
    columns.setIcon(header.getAppearance().columnsIcon());
    columns.setData("gxt-columns", "true");

    final Menu columnMenu = new Menu();

    int cols = cm.getColumnCount();
    for (int i = 0; i < cols; i++) {
      ColumnConfig<M, ?> config = cm.getColumn(i);
      // ignore columns with no header text
      if (!hasHeaderValue(i)) {
        continue;
      }
      final int fcol = i;
      final CheckMenuItem check = new CheckMenuItem();
      check.setHideOnClick(false);
      check.setHTML(cm.getColumnHeader(i));
      check.setChecked(!cm.isHidden(i));

      if (!config.isHideable()) {
        check.disable();
      }

      check.addCheckChangeHandler(new CheckChangeHandler<CheckMenuItem>() {

        @Override
        public void onCheckChange(CheckChangeEvent<CheckMenuItem> event) {
          cm.setHidden(fcol, !cm.isHidden(fcol));
          restrictMenu(cm, columnMenu);

        }
      });
      columnMenu.add(check);
    }

    restrictMenu(cm, columnMenu);
    columns.setEnabled(columnMenu.getWidgetCount() > 0);
    columns.setSubMenu(columnMenu);
    menu.add(columns);
    return menu;
  }
View Full Code Here

  }

  protected void onItemContextMenu(final Widget item, int x, int y) {
    if (closeMenu) {
      if (closeContextMenu == null) {
        closeContextMenu = new Menu();
        closeContextMenu.addHideHandler(new HideHandler() {

          @Override
          public void onHide(HideEvent event) {
            contextMenuItem = null;
View Full Code Here

   * Shows the column's header context menu.
   *
   * @param column the column index
   */
  public void showColumnMenu(final int column) {
    Menu menu = getContextMenu(column);

    if (menu == null) {
      return;
    }

    HeaderContextMenuEvent e = new HeaderContextMenuEvent(column, menu);
    container.fireEvent(e);
    if (e.isCancelled()) {
      return;
    }

    final Head h = getHead(column);
    menu.setId(h.getId() + "-menu");
    h.activateTrigger(true);
    menu.addHideHandler(new HideHandler() {

      @Override
      public void onHide(HideEvent event) {
        h.activateTrigger(false);
        container.focus();
      }
    });
    menu.show(h.getTrigger(), new AnchorAlignment(Anchor.TOP_LEFT, Anchor.BOTTOM_LEFT, true));
  }
View Full Code Here

  public void collapseAllGroups() {
    toggleAllGroups(false);
  }

  protected Menu createContextMenu(final int colIndex) {
    Menu menu = super.createContextMenu(colIndex);

    if (menu != null && enableGroupingMenu) {
      if (cm.isGroupable(colIndex)) {
        MenuItem groupBy = new MenuItem(DefaultMessages.getMessages().groupingView_groupByText());
        groupBy.setIcon(groupAppearance.groupByIcon());
        groupBy.addSelectionHandler(new SelectionHandler<Item>() {
          @Override
          public void onSelection(SelectionEvent<Item> event) {
            groupBy(cm.getColumn(colIndex));
          }
        });
        menu.add(new SeparatorMenuItem());
        menu.add(groupBy);

        groupBy.setEnabled(cm.getColumnCount(true) > 1);

        initMenuColumnShowHideHandling(menu, groupBy);
      }
      if (enableGrouping && enableNoGroups) {
        final CheckMenuItem showInGroups = new CheckMenuItem(
            DefaultMessages.getMessages().groupingView_showGroupsText());
        showInGroups.setChecked(true);
        showInGroups.addSelectionHandler(new SelectionHandler<Item>() {
          @Override
          public void onSelection(SelectionEvent<Item> event) {
            if (showInGroups.isChecked()) {
              groupBy(cm.getColumn(colIndex));
            } else {
              groupBy(null);
            }
          }
        });
        menu.add(showInGroups);
      }
    }

    return menu;
  }
View Full Code Here

      if (subMenuWidget instanceof MenuItem) {
        MenuItem columnsMenu = (MenuItem) subMenuWidget;
        String hasColumns = columnsMenu.getData("gxt-columns");
        // Find the columns and add handlers onto the CheckMenuItems columns
        if (hasColumns != null && hasColumns.equals("true")) {
          Menu colMenu = columnsMenu.getSubMenu();
          for (int b = 0; b < colMenu.getWidgetCount(); b++) {
            CheckMenuItem colItem = (CheckMenuItem) colMenu.getWidget(b);
            // Observe column events 'showing' and 'hiding' events
            colItem.addCheckChangeHandler(new CheckChangeHandler<CheckMenuItem>() {
              @Override
              public void onCheckChange(CheckChangeEvent<CheckMenuItem> event) {
                Scheduler.get().scheduleDeferred(new ScheduledCommand() {
View Full Code Here

    if (f != null) {
      filterMenu = f.getMenu();
      checkFilterItem.setChecked(f.isActive(), true);
      checkFilterItem.setSubMenu(filterMenu);

      Menu menu = event.getMenu();
      menu.add(separatorItem);
      menu.add(checkFilterItem);
    }
  }
View Full Code Here

   *          the data model associated with this filter.
   */
  public Filter(ValueProvider<? super M, V> valueProvider) {
    this.valueProvider = valueProvider;

    menu = new Menu();
  }
View Full Code Here

    rangeItems.add(RangeItem.LESSTHAN);
    rangeItems.add(RangeItem.GREATERTHAN);
    rangeItems.add(RangeItem.EQUAL);

    menu = new Menu();
    beforeItem = new CheckMenuItem();
    beforeItem.addCheckChangeHandler(handler);

    beforeMenu = new DateMenu();
    beforeMenu.addValueChangeHandler(handler);
View Full Code Here

  }

  protected void onItemContextMenu(final Widget item, int x, int y) {
    if (closeMenu) {
      if (closeContextMenu == null) {
        closeContextMenu = new Menu();
        closeContextMenu.addHideHandler(new HideHandler() {

          @Override
          public void onHide(HideEvent event) {
            contextMenuItem = null;
View Full Code Here

TOP

Related Classes of com.sencha.gxt.widget.core.client.menu.Menu$MenuAppearance

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.