01: package net.xoetrope.awt;
02:
03: import net.xoetrope.xml.XmlElement;
04: import net.xoetrope.xui.XMetaContentHolder;
05: import net.xoetrope.xui.style.XStyleComponent;
06:
07: /**
08: * <p>Implements a scrollable holder for a XMetaContent component </p>
09: * <p>Copyright: Copyright (c) Xoetrope Ltd., 1998-2003<br>
10: * License: see license.txt
11: * @version $Revision: 1.11 $
12: */
13: public class XScrollableMetaContent extends XScrollPane implements
14: XMetaContentHolder, XStyleComponent {
15: protected XMetaContent content;
16:
17: /**
18: * Constrcuts a new container for an XMetaContent component
19: */
20: public XScrollableMetaContent() {
21: content = new XMetaContent();
22: add(content, 0);
23: }
24:
25: /**
26: * Sets the meta content
27: * @param source the location from which the xml was obtained
28: * @param src the new content
29: */
30: public void setContent(String source, XmlElement src) {
31: content.setContent(source, src);
32: doLayout();
33: }
34:
35: /**
36: * Sets the meta content as a string
37: * @param cont the new string content
38: */
39: public void setContent(String cont) {
40: content.setContent(cont);
41: doLayout();
42: }
43:
44: /**
45: * Get the meta content's name .
46: * @return the model name of the content
47: */
48: public String getContent() {
49: return content.getContent();
50: }
51:
52: /**
53: * Get the source of the current content
54: * @return
55: */
56: public String getSource() {
57: if (content != null)
58: return content.getSource();
59:
60: return null;
61: }
62:
63: /**
64: * Sets the padding for the content
65: * @param padding
66: */
67: public void setPadding(int padding) {
68: content.setPadding(padding);
69: doLayout();
70: }
71:
72: /**
73: * Set the current style
74: * @param style the new style
75: */
76: public void setStyle(String style) {
77: content.setStyle(style);
78: }
79:
80: /**
81: * Sets the bounds for this component
82: * @param x
83: * @param y
84: * @param w
85: * @param h
86: */
87: public void setBounds(int x, int y, int w, int h) {
88: content.setBounds(0, 0, w, h);
89: super.setBounds(x, y, w, h);
90: doLayout();
91: }
92: }
|