01: package net.xoetrope.xui.test;
02:
03: import java.io.BufferedReader;
04: import java.io.FileInputStream;
05: import java.io.InputStreamReader;
06:
07: import java.awt.Frame;
08:
09: import junit.framework.TestCase;
10: import net.xoetrope.awt.XMetaContent;
11: import net.xoetrope.xml.XmlElement;
12: import net.xoetrope.xml.XmlSource;
13: import net.xoetrope.xui.XMetaContentHolder;
14: import net.xoetrope.xui.XProjectManager;
15: import net.xoetrope.xui.XResourceManager;
16: import net.xoetrope.xui.style.XStyleFactory;
17: import net.xoetrope.xui.style.XStyleManager;
18:
19: /**
20: * <p>Title: Xui</p>
21: * <p>Description: </p>
22: * <p>Copyright: Copyright (c) Xoetrope Ltd., 1998-2003</p>
23: * <p>Company: Xoetrope Ltd.</p>
24: * @author not attributable
25: * @version 1.0
26: */
27:
28: public class TestXMetaContent extends TestCase {
29:
30: private Frame frame;
31:
32: public TestXMetaContent() {
33: }
34:
35: public void testMetaContent() {
36: XProjectManager.getResourceManager();
37: XResourceManager
38: .setStartupFile("/resources/startup.properties");
39: XStyleManager manager = XProjectManager.getStyleManager();
40: XStyleFactory styleFactory = null;
41:
42: try {
43: styleFactory = new XStyleFactory("net.xoetrope.xui");
44: } catch (Exception ex1) {
45: System.out.println("No style file loaded!");
46: }
47:
48: XMetaContent meta = new XMetaContent();
49: meta.setBounds(50, 50, 400, 400);
50: meta.setBackground(java.awt.Color.red);
51:
52: try {
53: FileInputStream is = new FileInputStream(
54: "c:\\cvs\\xui\\Resource\\configres\\moreinfo.xml");
55: InputStreamReader isr = new InputStreamReader(is,
56: XResourceManager.getDefaultEncoding());
57: XmlElement src = XmlSource.read(new BufferedReader(isr));
58: ((XMetaContentHolder) meta).setContent(
59: "c:\\cvs\\xui\\Resource\\configres\\moreinfo.xml",
60: src);
61: } catch (Exception ex) {
62: ex.printStackTrace();
63: }
64:
65: frame = new Frame("XMetacontent test");
66: frame.setLayout(null);
67: frame.setSize(640, 480);
68: frame.add(meta);
69: frame.setVisible(true);
70: frame.show();
71: }
72: }
|