Sha256: fa8e3376415fa97db289808df245cdcad2423e32aa6fc0ca64bf2b1f38b76152

Contents?: true

Size: 1.86 KB

Versions: 1

Compression:

Stored size: 1.86 KB

Contents

/**
 * Sencha GXT 3.1.1 - Sencha for GWT
 * Copyright(c) 2007-2014, Sencha, Inc.
 * licensing@sencha.com
 *
 * http://www.sencha.com/products/gxt/license/
 */
package com.dldinternet.aws.cfn.stacker.desktop.client.widget;

import com.google.gwt.user.client.ui.Widget;
import com.dldinternet.aws.cfn.stacker.desktop.client.theme.base.startmenu.StartToolMenuAppearance;
import com.sencha.gxt.widget.core.client.menu.Menu;

/**
 * Provides the "tool menu" component of the start menu. The tool menu is
 * typically displayed on the right side of the start menu and contains items
 * that modify the state of the desktop.
 * 
 * @see StartToolMenuItem
 */
public class StartToolMenu extends Menu {

  private StartMenu startMenu;

  /**
   * Creates a tool menu for the specified start menu
   * 
   * @param startMenu the start menu that contains this tool menu
   */
  public StartToolMenu(StartMenu startMenu) {
    this(startMenu, new StartToolMenuAppearance());
  }

  /**
   * Creates a tool menu for the specified start menu, with the specified
   * appearance
   * 
   * @param startMenu the start menu that contains this tool menu
   * @param startToolMenuAppearance the appearance
   */
  public StartToolMenu(StartMenu startMenu, StartToolMenuAppearance startToolMenuAppearance) {
    super(startToolMenuAppearance);
    this.startMenu = startMenu;
  }

  /**
   * {@inheritDoc}
   * 
   * @throws IllegalArgumentException if the specified widget is not a
   *           {@link StartToolMenuItem}
   */
  @Override
  public void add(Widget child) {
    if (!(child instanceof StartToolMenuItem)) {
      throw new IllegalArgumentException("Widget is not a StartToolMenuItem");
    }
    super.add(child);
  }

  @Override
  public void hide(boolean deep) {
    if (activeItem != null) {
      ((StartToolMenuItem) activeItem).hideSubMenu();
      activeItem = null;
    }
    startMenu.hide();
  }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aws-cfn-stacker-0.0.6 ui/src/com/dldinternet/aws/cfn/stacker/desktop/client/widget/StartToolMenu.java