Tool Strips Sample (Smart GWT) : ToolBar « GWT « Java






Tool Strips Sample (Smart GWT)

Tool Strips Sample (Smart GWT)
   
/*
 * SmartGWT (GWT for SmartClient)
 * Copyright 2008 and beyond, Isomorphic Software, Inc.
 *
 * SmartGWT is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License version 3
 * as published by the Free Software Foundation.  SmartGWT is also
 * available under typical commercial license terms - see
 * http://smartclient.com/license
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 */
package com.smartgwt.sample.showcase.client;

import java.util.LinkedHashMap;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.smartgwt.client.types.SelectionType;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.ImgButton;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
import com.smartgwt.client.widgets.toolbar.ToolStripSeparator;

public class Showcase implements EntryPoint {

  public void onModuleLoad() {
    RootPanel.get().add(getViewPanel());
  }
  
  public Canvas getViewPanel() {
    ToolStrip toolStrip = new ToolStrip();
    toolStrip.setWidth(450);
    toolStrip.setHeight(24);

    ImgButton boldButton = new ImgButton();
    boldButton.setSize(24);
    boldButton.setShowRollOver(false);
    boldButton.setSrc("icons/24/text_bold.png");
    boldButton.setActionType(SelectionType.CHECKBOX);
    toolStrip.addMember(boldButton);
    
    ImgButton italicsButton = new ImgButton();
    italicsButton.setSize(24);
    italicsButton.setShowRollOver(false);
    italicsButton.setSrc("icons/24/text_italics.png");
    italicsButton.setActionType(SelectionType.CHECKBOX);
    toolStrip.addMember(italicsButton);
    
    ImgButton underlineButton = new ImgButton();
    underlineButton.setSize(24);
    underlineButton.setShowRollOver(false);
    underlineButton.setSrc("icons/24/text_underlined.png");
    underlineButton.setActionType(SelectionType.CHECKBOX);
    toolStrip.addMember(underlineButton);

    ToolStripSeparator stripSeparator = new ToolStripSeparator();
    stripSeparator.setHeight(8);

    toolStrip.addMember(stripSeparator);
    
    ImgButton alignLeftButton = new ImgButton();
    alignLeftButton.setSize(24);
    alignLeftButton.setShowRollOver(false);
    alignLeftButton.setSrc("icons/24/text_align_left.png");
    alignLeftButton.setActionType(SelectionType.RADIO);
    alignLeftButton.setRadioGroup("textAlign");
    toolStrip.addMember(alignLeftButton);
    
    ImgButton alignRightButton = new ImgButton();
    alignRightButton.setSize(24);
    alignRightButton.setShowRollOver(false);
    alignRightButton.setSrc("icons/24/text_align_right.png");
    alignRightButton.setActionType(SelectionType.RADIO);
    alignRightButton.setRadioGroup("textAlign");
    toolStrip.addMember(alignRightButton);
    
    ImgButton alignCenterButton = new ImgButton();
    alignCenterButton.setSize(24);
    alignCenterButton.setShowRollOver(false);
    alignCenterButton.setSrc("icons/24/text_align_center.png");
    alignCenterButton.setActionType(SelectionType.RADIO);
    alignCenterButton.setRadioGroup("textAlign");
    toolStrip.addMember(alignCenterButton);

    toolStrip.addMember(stripSeparator);

    DynamicForm fontForm = new DynamicForm();
    fontForm.setShowResizeBar(true);
    fontForm.setWidth("*");
    fontForm.setMinWidth(50);
    fontForm.setNumCols(1);

    SelectItem fontItem = new SelectItem();
    fontItem.setShowTitle(false);
    fontItem.setWidth("*");

    LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
    valueMap.put("courier", "<span style='font-family:courier'>Courier</span>");
    valueMap.put("verdana", "<span style='font-family:verdana'>Verdana</span>");
    valueMap.put("times", "<span style='font-family:times'>Times</span>");
    fontItem.setValueMap(valueMap);
    fontForm.setItems(fontItem);
    fontItem.setDefaultValue("courier");
    toolStrip.addMember(fontForm);

    //toolStrip.addMember(new ToolStripResizer());
    
    DynamicForm zoomForm = new DynamicForm();
    zoomForm.setWidth("*");
    zoomForm.setMinWidth(50);
    zoomForm.setNumCols(1);

    SelectItem zoomItems = new SelectItem();
    zoomItems.setName("selectName");
    zoomItems.setShowTitle(false);
    zoomItems.setWidth("*");
    zoomItems.setValueMap("50%", "75%", "100%", "200%", "Fit");
    zoomItems.setDefaultValue("100%");
    zoomForm.setItems(zoomItems);

    toolStrip.addMember(zoomForm);
    
    return toolStrip;
  }

}

   
    
    
  








SmartGWT.zip( 9,880 k)

Related examples in the same category

1.Adding ComboBox to ToolBar (Ext GWT)Adding ComboBox to ToolBar (Ext GWT)
2.ToolBar overflow (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)