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.layout;
09:
10: import com.gwtext.client.core.Margins;
11: import com.gwtext.client.core.RegionPosition;
12: import com.gwtext.client.widgets.PaddedPanel;
13: import com.gwtext.client.widgets.Panel;
14: import com.gwtext.client.widgets.layout.*;
15: import com.gwtext.sample.showcase2.client.SampleData;
16: import com.gwtext.sample.showcase2.client.ShowcasePanel;
17:
18: public class CombinedLayoutSample extends ShowcasePanel {
19:
20: public String getSourceUrl() {
21: return "source/layout/CombinedLayoutSample.java.html";
22: }
23:
24: public Panel getViewPanel() {
25: if (panel == null) {
26: panel = new Panel();
27: panel.setLayout(new FitLayout());
28:
29: Panel borderPanel = new Panel();
30: borderPanel
31: .setTitle("Use of BorderLayout, AccordionLayout and ColumnLayout");
32: borderPanel.setLayout(new BorderLayout());
33:
34: final AccordionLayout accordion = new AccordionLayout();
35: accordion.setAnimate(true);
36:
37: Panel westPanel = new Panel();
38: westPanel.setTitle("West");
39: westPanel.setCollapsible(true);
40: westPanel.setWidth(200);
41: westPanel.setLayout(accordion);
42:
43: Panel navigationPanel = new Panel();
44: navigationPanel.setHtml(SampleData.getShortBogusMarkup());
45: navigationPanel.setTitle("Navigation");
46: navigationPanel.setAutoScroll(true);
47: navigationPanel.setBorder(false);
48: navigationPanel.setIconCls("folder-icon");
49: westPanel.add(navigationPanel);
50:
51: Panel settingsPanel = new Panel();
52: settingsPanel.setHtml(SampleData.getShortBogusMarkup());
53: settingsPanel.setTitle("Settings");
54: settingsPanel.setAutoScroll(true);
55: settingsPanel.setBorder(false);
56: settingsPanel.setIconCls("settings-icon");
57: westPanel.add(settingsPanel);
58:
59: BorderLayoutData westData = new BorderLayoutData(
60: RegionPosition.WEST);
61: westData.setSplit(true);
62: westData.setMinSize(175);
63: westData.setMaxSize(400);
64: westData.setMargins(new Margins(35, 5, 0, 5));
65: westData.setCMargins(new Margins(35, 5, 5, 5));
66: borderPanel.add(westPanel, westData);
67:
68: Panel centerPanel = new Panel();
69: centerPanel.setAutoScroll(true);
70: centerPanel.setLayout(new ColumnLayout());
71:
72: Panel firstPanel = new PaddedPanel(new Panel("A Panel",
73: SampleData.getShortBogusMarkup()), 5, 5, 0, 5);
74: Panel secondPanel = new PaddedPanel(new Panel("A Panel",
75: SampleData.getShortBogusMarkup()), 5, 5, 0, 5);
76: Panel thirdPanel = new PaddedPanel(new Panel("A Panel",
77: SampleData.getShortBogusMarkup()), 5, 5, 0, 5);
78: thirdPanel.add(new PaddedPanel(new Panel("Another Panel",
79: SampleData.getShortBogusMarkup()), 5, 0, 0, 5));
80:
81: centerPanel.add(firstPanel, new ColumnLayoutData(0.33));
82: centerPanel.add(secondPanel, new ColumnLayoutData(0.33));
83: centerPanel.add(thirdPanel, new ColumnLayoutData(0.333));
84:
85: BorderLayoutData centerData = new BorderLayoutData(
86: RegionPosition.CENTER);
87: centerData.setMargins(35, 0, 5, 5);
88: borderPanel.add(centerPanel, centerData);
89: panel.add(borderPanel);
90:
91: }
92: return panel;
93: }
94: }
|