ToolBar overflow (Ext GWT) : ToolBar « GWT « Java






ToolBar overflow (Ext GWT)

 

/*
 * Ext GWT - Ext for GWT
 * Copyright(c) 2007-2009, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */
 
 
package com.google.gwt.sample.hello.client;

import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.button.ButtonGroup;
import com.extjs.gxt.ui.client.widget.layout.FlowData;
import com.extjs.gxt.ui.client.widget.menu.Menu;
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
import com.extjs.gxt.ui.client.widget.toolbar.FillToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.RootPanel;

public class Hello implements EntryPoint {

  public void onModuleLoad() {

    RootPanel.get().add(new ToolBarOverflowExample());

  }
}
class ToolBarOverflowExample extends LayoutContainer {

  @Override
  protected void onRender(Element parent, int pos) {
    super.onRender(parent, pos);
    final Window window = new Window();

    window.setHeading("Overflow Example");
    window.setSize(400, 200);
    window.setMinWidth(50);
    window.setFrame(true);

    ToolBar toolBar = new ToolBar();

    ButtonGroup group = new ButtonGroup(2);
    group.setHeading("Clipboard");

    Button btn = new Button("Cool");
    group.add(btn);

    btn = new Button("Cut");
    Menu menu = new Menu();
    menu.add(new MenuItem("Copy me"));
    btn.setMenu(menu);
    group.add(btn);

    btn = new Button("Copy");
    group.add(btn);

    btn = new Button("Paste");
    group.add(btn);

    toolBar.add(group);

    toolBar.add(new FillToolItem());

    group = new ButtonGroup(2);
    group.setHeading("Other Bugus Actions");

    btn = new Button("Cool");
    group.add(btn);

    btn = new Button("Cut");
    menu = new Menu();
    menu.add(new MenuItem("Copy me"));
    btn.setMenu(menu);
    group.add(btn);

    btn = new Button("Copy");
    group.add(btn);

    btn = new Button("Paste");
    group.add(btn);

    toolBar.add(group);

    window.setTopComponent(toolBar);
    window.setButtonAlign(HorizontalAlignment.CENTER);
    window.addButton(new Button("Save"));
    window.addButton(new Button("Cancel"));
    window.addButton(new Button("Close"));
    window.addButton(new Button("Highlight"));
    window.addButton(new Button("Shutdown"));
    add(new Button("ToolBar Overflow Example", new SelectionListener<ButtonEvent>() {
      @Override
      public void componentSelected(ButtonEvent ce) {
        window.show();
      }

    }), new FlowData(10));
  }
}

   
  








Ext-GWT.zip( 4,297 k)

Related examples in the same category

1.Tool Strips Sample (Smart GWT)Tool Strips Sample (Smart GWT)
2.Adding ComboBox to ToolBar (Ext GWT)Adding ComboBox to ToolBar (Ext GWT)
3.ToolBar with Dropdown menu (Ext GWT)ToolBar with Dropdown menu (Ext GWT)
4.Ribbon like ToolBar (Ext GWT)Ribbon like ToolBar (Ext GWT)
5.Multi-column no-title ToolBar (Ext GWT)Multi-column no-title ToolBar (Ext GWT)
6.ToolBar with grouped buttons (Ext GWT)ToolBar with grouped buttons (Ext GWT)
7.Office 2007 style toolbar (Ext GWT)Office 2007 style toolbar (Ext GWT)
8.Adding menu bar to ContentPanel (Ext GWT)Adding menu bar to ContentPanel (Ext GWT)
9.Adding Status to ToolBar (Ext GWT)Adding Status to ToolBar (Ext GWT)
10.Add ToolBar to the bottom of a FormPanel (Ext GWT)Add ToolBar to the bottom of a FormPanel (Ext GWT)
11.Adding ToolBar to ContentPanel (Ext GWT)Adding ToolBar to ContentPanel (Ext GWT)
12.Using ButtonBar to hold buttons (Ext GWT)Using ButtonBar to hold buttons (Ext GWT)