Ejemplo n.º 1
0
  /**
   * Sets the active item. The component must be of type <code>Item</code> to be activated. All
   * other types are ignored.
   *
   * @param c the component to set active
   * @param autoExpand true to auto expand the item
   */
  public void setActiveItem(Component c, boolean autoExpand) {
    if (c == null) {
      deactiveActiveItem();
      return;
    }
    if (c instanceof Item) {
      Item item = (Item) c;
      if (item != activeItem) {
        deactiveActiveItem();

        this.activeItem = item;
        item.activate(autoExpand);
        item.el().scrollIntoView(ul.dom, false);
        focus();

        if (GXT.isFocusManagerEnabled()) {
          FocusFrame.get().frame(item);
          Accessibility.setState(getElement(), "aria-activedescendant", item.getId());
        }

      } else if (autoExpand) {
        item.expandMenu(autoExpand);
      }
    }
  }
Ejemplo n.º 2
0
 protected void deactiveActiveItem() {
   if (activeItem != null) {
     activeItem.deactivate();
     activeItem = null;
   }
   if (GXT.isFocusManagerEnabled()) {
     FocusFrame.get().unframe();
     Accessibility.setState(getElement(), "aria-activedescendant", "");
   }
 }
Ejemplo n.º 3
0
 protected void onFocus(ComponentEvent ce) {
   if (GXT.isFocusManagerEnabled() && !GXT.isIE) {
     FocusFrame.get().frame(this);
   }
 }
Ejemplo n.º 4
0
 protected void onBlur(ComponentEvent ce) {
   if (GXT.isFocusManagerEnabled()) {
     FocusFrame.get().unframe();
   }
 }