01: /*
02: * GWT-Ext Widget Library
03: * Copyright(c) 2007-2008, GWT-Ext.
04: * licensing@gwt-ext.com
05: *
06: * http://www.gwt-ext.com/license
07: */
08: package com.gwtext.sample.showcase2.client.misc;
09:
10: import com.gwtext.client.core.Ext;
11: import com.gwtext.client.core.ExtElement;
12: import com.gwtext.client.widgets.Panel;
13: import com.gwtext.client.widgets.form.Checkbox;
14: import com.gwtext.client.widgets.form.FormPanel;
15: import com.gwtext.client.widgets.form.TextField;
16: import com.gwtext.client.widgets.form.event.CheckboxListenerAdapter;
17: import com.gwtext.sample.showcase2.client.ShowcasePanel;
18:
19: public class MaskingSample extends ShowcasePanel {
20:
21: public String getSourceUrl() {
22: return "source/misc/MaskingSample.java.html";
23: }
24:
25: public Panel getViewPanel() {
26: if (panel == null) {
27: panel = new Panel();
28:
29: FormPanel formPanel = new FormPanel();
30: formPanel.setTitle("Mask Region");
31: formPanel.setBorder(false);
32: formPanel.setFrame(true);
33: formPanel.setWidth(400);
34: formPanel.setLabelWidth(100);
35:
36: final TextField maskField = new TextField("Mask Message",
37: "maskMessage", 175);
38: maskField.setSelectOnFocus(true);
39: formPanel.add(maskField);
40:
41: Checkbox maskNav = new Checkbox();
42: maskNav.setBoxLabel("Mask Side Nav");
43: maskNav.addListener(new CheckboxListenerAdapter() {
44: public void onCheck(Checkbox field, boolean checked) {
45: String message = maskField.getText();
46: final ExtElement element = Ext.get("side-nav");
47: if (checked) {
48: if (message.trim().equals("")) {
49: element.mask();
50: } else {
51: element.mask(message);
52: }
53: } else {
54: element.unmask();
55: }
56: }
57: });
58: formPanel.add(maskNav);
59:
60: panel.add(formPanel);
61: }
62: return panel;
63: }
64:
65: public String getIntro() {
66: return "<p>This example demonstrates masking elements. Masking containers is an effective way of disabling the control and its children.</p>"
67: + "<p>Any element can be masked like TreePanel, Grids etc</p>";
68: }
69: }
|