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.widgets.PaddedPanel;
11: import com.gwtext.client.widgets.Panel;
12: import com.gwtext.client.widgets.layout.FitLayout;
13: import com.gwtext.client.widgets.layout.TableLayout;
14: import com.gwtext.client.widgets.layout.TableLayoutData;
15: import com.gwtext.sample.showcase2.client.ShowcasePanel;
16:
17: public class TableSample extends ShowcasePanel {
18:
19: public String getSourceUrl() {
20: return "source/layout/TableSample.java.html";
21: }
22:
23: public Panel getViewPanel() {
24: if (panel == null) {
25: panel = new Panel();
26: panel.setLayout(new FitLayout());
27:
28: Panel wrapperPanel = new Panel();
29: wrapperPanel.setAutoScroll(true);
30: wrapperPanel.setBorder(true);
31: wrapperPanel
32: .setBodyStyle("border-style:dotted;border-color:blue;");
33: wrapperPanel.setLayout(new TableLayout(3));
34: //this add a blue background to the panel content area
35: wrapperPanel.setBaseCls("x-plain");
36:
37: //add top and right padding to each panel so that they look neat instead of right beside each other
38: wrapperPanel.add(new PaddedPanel(new Panel("Item 1", 100,
39: 100), 0, 0, 10, 10));
40: wrapperPanel.add(new PaddedPanel(new Panel("Item 2", 100,
41: 100), 0, 0, 10, 10));
42: wrapperPanel.add(new PaddedPanel(new Panel("Item 3", 100,
43: 100), 0, 0, 10, 10));
44:
45: wrapperPanel.add(new PaddedPanel(new Panel("Item 4", 210,
46: 100), 0, 0, 10, 10), new TableLayoutData(2));
47: wrapperPanel.add(new PaddedPanel(new Panel("Item 5", 100,
48: 100), 0, 0, 10, 10));
49: wrapperPanel.add(new PaddedPanel(new Panel("Item 6", 100,
50: 100), 0, 0, 10, 10));
51: wrapperPanel.add(new PaddedPanel(new Panel("Item 7", 210,
52: 100), 0, 0, 10, 10), new TableLayoutData(2));
53: wrapperPanel.add(new PaddedPanel(new Panel("Item 8", 100,
54: 100), 0, 0, 10, 10));
55:
56: panel.add(wrapperPanel);
57: }
58: return panel;
59: }
60:
61: public String getIntro() {
62: return "<p>This example demonstrates a TableLayout. You specify the number of columns in the TableLayout and add"
63: + " child panels to the parent panel which has been assigned the TableLayout. The panels will get laid out accoridn to the table specification.</p>"
64: + "<p> You can control the rowspan and colspan of panels as illustrated in this example where the Panel in the second row"
65: + " has a colspan of 2.</p>";
66: }
67: }
|