Set busy status for Status control (Ext GWT) : Form « GWT « Java

Home
Java
1.2D Graphics GUI
2.3D
3.Advanced Graphics
4.Ant
5.Apache Common
6.Chart
7.Class
8.Collections Data Structure
9.Data Type
10.Database SQL JDBC
11.Design Pattern
12.Development Class
13.EJB3
14.Email
15.Event
16.File Input Output
17.Game
18.Generics
19.GWT
20.Hibernate
21.I18N
22.J2EE
23.J2ME
24.JDK 6
25.JNDI LDAP
26.JPA
27.JSP
28.JSTL
29.Language Basics
30.Network Protocol
31.PDF RTF
32.Reflection
33.Regular Expressions
34.Scripting
35.Security
36.Servlets
37.Spring
38.Swing Components
39.Swing JFC
40.SWT JFace Eclipse
41.Threads
42.Tiny Application
43.Velocity
44.Web Services SOA
45.XML
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Java » GWT » FormScreenshots 
Set busy status for Status control (Ext GWT)
Set busy status for Status control (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.event.BaseEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.FieldEvent;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.util.DelayedTask;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.Status;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.form.TextArea;
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.extjs.gxt.ui.client.widget.toolbar.FillToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.LabelToolItem;
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 StatusToolBarExample());

  }
}
class StatusToolBarExample extends LayoutContainer {
  private DelayedTask task = new DelayedTask(new Listener<BaseEvent>() {

    public void handleEvent(BaseEvent be) {
      status.clearStatus("Not writing");
    }

  });

  private Status charCount;
  private Status wordCount;
  private Status status;

  @Override
  protected void onRender(Element parent, int pos) {
    super.onRender(parent, pos);
    setLayout(new FlowLayout(10));

    ToolBar toolBar = new ToolBar();

    status = new Status();
    status.setText("Not writing");
    status.setWidth(150);
    toolBar.add(status);
    toolBar.add(new FillToolItem());

    charCount = new Status();
    charCount.setWidth(100);
    charCount.setText("0 Chars");
    charCount.setBox(true);
    toolBar.add(charCount);
    toolBar.add(new LabelToolItem("&nbsp;"));
    wordCount = new Status();
    wordCount.setWidth(100);
    wordCount.setText("0 Words");
    wordCount.setBox(true);
    toolBar.add(wordCount);

    FormPanel form new FormPanel();
    form.setHeading("Status Toolbar");
    form.setSize(450300);
    form.setPadding(5);
    form.setBottomComponent(toolBar);
    TextArea textArea = new TextArea();
    textArea.setHideLabel(true);
    textArea.addListener(Events.OnKeyPress, new Listener<FieldEvent>() {

      public void handleEvent(FieldEvent be) {
        status.setBusy("writing...");
        TextArea t = (TextAreabe.getField();
        String value = t.getValue();
        int length = value != null ? value.length() 0;
        charCount.setText(length + (length == " Char" " Chars"));

        if (value != null) {
          int wc = getWordCount(value);
          wordCount.setText(wc + (wc == " Word" " Words"));
        }

        task.delay(1000);
      }

    });
    form.add(textArea, new FormData("100% 100%"));
    add(form);
  }

  public native int getWordCount(String v/*-{
    if(v) {
    var wc = v.match(/\b/g);
    return wc ? wc.length/2:0;
    }
    return 0;
  }-*/;

}

   
  
Ext-GWT.zip( 4,297 k)
Related examples in the same category
1.Adding border line to a form (Smart GWT)Adding border line to a form (Smart GWT)
2.Forms are split for layout (Smart GWT)Forms are split for layout (Smart GWT)
3.Form validation for splitted form (Smart GWT)
4.Drag resize the form from the right edge (Smart GWT)Drag resize the form from the right edge (Smart GWT)
5.Form data validation (Smart GWT)Form data validation (Smart GWT)
6.Form data binding (Smart GWT)Form data binding (Smart GWT)
7.Form Filling Layout Sample (Smart GWT)Form Filling Layout Sample (Smart GWT)
8.Set form width (Smart GWT)Set form width (Smart GWT)
9.Change title Orientation (Smart GWT)Change title Orientation (Smart GWT)
10.Form controls Show/Hide Sample (Smart GWT)Form controls Show/Hide Sample (Smart GWT)
11.Form control Enable/Disable Sample (Smart GWT)Form control Enable/Disable Sample (Smart GWT)
12.Form Dependent Selects Sample (Smart GWT)Form Dependent Selects Sample (Smart GWT)
13.Add fields to a form with setFields (Smart GWT)Add fields to a form with setFields (Smart GWT)
14.Form Data bound Dependent Selects Sample (Smart GWT)Form Data bound Dependent Selects Sample (Smart GWT)
15.Expand or collapse the text box (Smart GWT)Expand or collapse the text box (Smart GWT)
16.Link the table and form fields (Smart GWT)Link the table and form fields (Smart GWT)
17.Using FormPanel to layout fields (Ext GWT)Using FormPanel to layout fields (Ext GWT)
18.Two-column form (Ext GWT)Two-column form (Ext GWT)
19.Collapsible FieldSet (Ext GWT)Collapsible FieldSet (Ext GWT)
20.CheckBox toggling FieldSet (Ext GWT)CheckBox toggling FieldSet (Ext GWT)
21.Support for standard Panel features such as framing, buttons and toolbars (Ext GWT)Support for standard Panel features such as framing, buttons and toolbars (Ext GWT)
22.ContentPanel with buttons (Ext GWT)ContentPanel with buttons (Ext GWT)
23.Make ContentPanel Collapsible (Ext GWT)Make ContentPanel Collapsible (Ext GWT)
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.