01: package net.xoetrope.samples.ctlsamples;
02:
03: import net.xoetrope.awt.XComboBox;
04: import net.xoetrope.awt.XTable;
05: import net.xoetrope.xui.XPage;
06: import net.xoetrope.xui.XProjectManager;
07: import net.xoetrope.xui.data.XModel;
08:
09: public class Table extends XPage {
10: XTable table;
11: XComboBox cmbSelect;
12:
13: public Table() {
14: table = (XTable) componentFactory.addComponent(XPage.TABLE, 5,
15: 5, 220, 200);
16: table.setStyle("base/TableData");
17: table.setHeaderStyle("base/TableHeading");
18: table.setSelectedStyle("base/TableSelection");
19: XModel model = (XModel) XProjectManager.getModel().get(
20: "componentlist/items");
21: table.setModel(model);
22: table.setInteractiveTable(true);
23: table.setSelectedRow(0);
24:
25: componentFactory.addComponent(XPage.LABEL, 10, 230, 100, 20,
26: "Selected row", "prompt");
27: cmbSelect = (XComboBox) componentFactory.addComponent(
28: XPage.COMBO, 120, 230, 50, 20, null, "prompt");
29: cmbSelect.addItem("0");
30: cmbSelect.addItem("1");
31: cmbSelect.addItem("2");
32: cmbSelect.addItem("3");
33: cmbSelect.addItem("4");
34: addItemHandler(cmbSelect, "selectRow");
35: }
36:
37: public void selectRow() {
38: table.setSelectedRow(cmbSelect.getSelectedIndex());
39: }
40: }
|