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.window;
09:
10: import com.gwtext.client.core.EventObject;
11: import com.gwtext.client.core.RegionPosition;
12: import com.gwtext.client.widgets.Button;
13: import com.gwtext.client.widgets.Panel;
14: import com.gwtext.client.widgets.TabPanel;
15: import com.gwtext.client.widgets.Window;
16: import com.gwtext.client.widgets.event.ButtonListenerAdapter;
17: import com.gwtext.client.widgets.layout.BorderLayout;
18: import com.gwtext.client.widgets.layout.BorderLayoutData;
19: import com.gwtext.sample.showcase2.client.SampleData;
20: import com.gwtext.sample.showcase2.client.ShowcasePanel;
21:
22: public class LayoutWindowSample extends ShowcasePanel {
23:
24: public String getSourceUrl() {
25: return "source/window/LayoutWindowSample.java.html";
26: }
27:
28: public Panel getViewPanel() {
29: if (panel == null) {
30: panel = new Panel();
31:
32: //center panel
33: TabPanel tabPanel = new TabPanel();
34: tabPanel.setActiveTab(0);
35:
36: Panel tab1 = new Panel();
37: tab1.setTitle("Bogus Tab");
38: tab1.setHtml(SampleData.getBogusMarkup());
39: tab1.setAutoScroll(true);
40:
41: Panel tab2 = new Panel();
42: tab2.setTitle("Another Tab");
43: tab2.setHtml(SampleData.getBogusMarkup());
44: tab2.setAutoScroll(true);
45:
46: Panel tab3 = new Panel();
47: tab3.setTitle("Closable Tab");
48: tab3.setHtml(SampleData.getBogusMarkup());
49: tab3.setAutoScroll(true);
50: tab3.setClosable(true);
51:
52: tabPanel.add(tab1);
53: tabPanel.add(tab2);
54: tabPanel.add(tab3);
55:
56: //west panel
57: Panel navPanel = new Panel();
58: navPanel.setTitle("Navigation");
59: navPanel.setWidth(200);
60: navPanel.setCollapsible(true);
61:
62: BorderLayoutData centerData = new BorderLayoutData(
63: RegionPosition.CENTER);
64: centerData.setMargins(3, 0, 3, 3);
65:
66: BorderLayoutData westData = new BorderLayoutData(
67: RegionPosition.WEST);
68: westData.setSplit(true);
69: westData.setMargins(3, 3, 0, 3);
70: westData.setCMargins(3, 3, 3, 3);
71:
72: final Window window = new Window();
73: window.setTitle("Layout Window");
74: window.setClosable(true);
75: window.setWidth(600);
76: window.setHeight(350);
77: window.setPlain(true);
78: window.setLayout(new BorderLayout());
79: window.add(tabPanel, centerData);
80: window.add(navPanel, westData);
81: window.setCloseAction(Window.HIDE);
82:
83: Button button = new Button("Show Window");
84: button.addListener(new ButtonListenerAdapter() {
85: public void onClick(Button button, EventObject e) {
86: window.show(button.getId());
87: }
88: });
89:
90: panel.add(button);
91: }
92: return panel;
93: }
94: }
|