1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
* Ext GWT - Ext for GWT
* Copyright(c) 2007, 2008, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
package com.extjs.gxt.samples.explorer.client.pages;
import com.extjs.gxt.samples.resources.client.TestData;
import com.extjs.gxt.ui.client.Style.LayoutRegion;
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.RootPanel;
public class DialogPage extends LayoutContainer implements EntryPoint {
public void onModuleLoad() {
RootPanel.get().add(this);
}
@Override
protected void onRender(Element parent, int pos) {
super.onRender(parent, pos);
final Dialog simple = new Dialog();
simple.setHeading("Dialog Test");
simple.setButtons(Dialog.YESNO);
simple.setBodyStyleName("pad-text");
simple.addText(TestData.DUMMY_TEXT_SHORT);
simple.setScrollMode(Scroll.AUTO);
simple.setHideOnButtonClick(true);
final Dialog complex = new Dialog();
complex.setBodyBorder(false);
complex.setInsetBorder(false);
complex.setButtons(Dialog.OK);
complex.setIconStyle("icon-app-side");
complex.setHeading("BorderLayout Dialog");
complex.setWidth(400);
complex.setHeight(225);
complex.setHideOnButtonClick(true);
BorderLayout layout = new BorderLayout();
complex.setLayout(layout);
// west
ContentPanel panel = new ContentPanel();
panel.setHeading("West");
BorderLayoutData data = new BorderLayoutData(LayoutRegion.WEST, 150, 100, 250);
data.setMargins(new Margins(0, 5, 0, 0));
data.setSplit(true);
data.setCollapsible(true);
data.setFloatable(true);
complex.add(panel, data);
// center
panel = new ContentPanel();
panel.setHeading("West");
data = new BorderLayoutData(LayoutRegion.CENTER);
complex.add(panel, data);
ButtonBar buttons = new ButtonBar();
buttons.add(new Button("Simple", new SelectionListener<ComponentEvent>() {
public void componentSelected(ComponentEvent ce) {
simple.show();
}
}));
buttons.add(new Button("Layout", new SelectionListener<ComponentEvent>() {
public void componentSelected(ComponentEvent ce) {
complex.show();
}
}));
add(buttons);
setLayout(new FlowLayout(4));
layout();
}
}