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.grid;
09:
10: import com.gwtext.client.widgets.Panel;
11: import com.gwtext.client.widgets.grid.*;
12: import com.gwtext.sample.showcase2.client.SampleGrid;
13: import com.gwtext.sample.showcase2.client.ShowcasePanel;
14:
15: public class NumberedRowsSample extends ShowcasePanel {
16:
17: public String getSourceUrl() {
18: return "source/grid/NumberedRowsSample.java.html";
19: }
20:
21: public Panel getViewPanel() {
22: if (panel == null) {
23: GridPanel grid = new SampleGrid() {
24:
25: protected ColumnModel getColumnConfigs() {
26: BaseColumnConfig[] columnConfigs = new BaseColumnConfig[columns.length + 1];
27: columnConfigs[0] = new RowNumberingColumnConfig();
28: for (int i = 0; i < columns.length; i++) {
29: BaseColumnConfig column = columns[i];
30: columnConfigs[i + 1] = column;
31: }
32: return new ColumnModel(columnConfigs);
33: }
34: };
35:
36: grid.setTitle("Grid with Numbered Rows and Force Fit");
37: grid.setHeight(300);
38: grid.setWidth(600);
39: grid.setIconCls("grid-icon");
40:
41: GridView view = new GridView();
42: view.setForceFit(true);
43: grid.setView(view);
44:
45: panel = new Panel();
46: panel.add(grid);
47: }
48: return panel;
49: }
50:
51: public String getIntro() {
52: return "This example has a Grid with row numbering and Force Fit. ";
53: }
54: }
|