01: package net.xoetrope.xui.data.test;
02:
03: import junit.framework.TestCase;
04: import net.xoetrope.builder.editor.helper.XTableModelHelper;
05: import net.xoetrope.debug.DebugLogger;
06: import net.xoetrope.xui.XProjectManager;
07: import net.xoetrope.xui.data.XBaseModel;
08: import net.xoetrope.xui.data.XModel;
09:
10: /**
11: * <p>Title: Xui</p>
12: * <p>Description: </p>
13: * <p>Copyright: Copyright (c) Xoetrope Ltd., 1998-2003</p>
14: * <p>Company: Xoetrope Ltd.</p>
15: * @author not attributable
16: * @version 1.0
17: */
18:
19: public class TestModel extends TestCase {
20:
21: public static void main(String args[]) {
22: new TestModel();
23: }
24:
25: public TestModel() {
26: testModel();
27: }
28:
29: public void testModel() {
30: XBaseModel dset = (XBaseModel) XTableModelHelper
31: .createDataSet("events");
32: XBaseModel tableModel = (XBaseModel) XTableModelHelper
33: .createTable(dset, "items");
34: XBaseModel header = (XBaseModel) XTableModelHelper
35: .addHeader(tableModel);
36: XTableModelHelper.addData(header, "event", "event");
37: XTableModelHelper.addData(header, "control", "control");
38: XTableModelHelper.addData(header, "value", "value");
39:
40: XModel baseModel = (XModel) XProjectManager.getModel();
41: XBaseModel settings = new XBaseModel();
42: settings.setTagName("dataset");
43: settings.setAttribValue(1, "settings");
44: baseModel.append(settings);
45:
46: XBaseModel urlModel = new XBaseModel();
47: urlModel.setTagName("data");
48: urlModel.setAttribValue(1, "url");
49: urlModel.set("The url");
50: settings.append(urlModel);
51: System.out.println("before dump 1");
52: DebugLogger.dumpModel((XBaseModel) XProjectManager.getModel()
53: .get("base/settings"));
54: System.out.println("after dump 2");
55: }
56: }
|