01: /* Treefoot.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Fri Jan 19 15:36:05 2007, Created by tomyeh
10: }}IS_NOTE
11:
12: Copyright (C) 2007 Potix Corporation. All Rights Reserved.
13:
14: {{IS_RIGHT
15: This program is distributed under GPL Version 2.0 in the hope that
16: it will be useful, but WITHOUT ANY WARRANTY.
17: }}IS_RIGHT
18: */
19: package org.zkoss.zul;
20:
21: import org.zkoss.zk.ui.Component;
22: import org.zkoss.zk.ui.UiException;
23:
24: import org.zkoss.zul.impl.XulElement;
25:
26: /**
27: * A row of {@link Treefooter}.
28: *
29: * <p>Like {@link Treecols}, each tree has at most one {@link Treefoot}.
30: *
31: * @author tomyeh
32: */
33: public class Treefoot extends XulElement {
34: /** Returns the tree that it belongs to.
35: * <p>It is the same as {@link #getParent}.
36: */
37: public Tree getTree() {
38: return (Tree) getParent();
39: }
40:
41: //-- Component --//
42: public void setParent(Component parent) {
43: if (parent != null && !(parent instanceof Tree))
44: throw new UiException("Wrong parent: " + parent);
45: super .setParent(parent);
46: }
47:
48: public boolean insertBefore(Component child, Component insertBefore) {
49: if (!(child instanceof Treefooter))
50: throw new UiException("Unsupported child for treefoot: "
51: + child);
52: return super.insertBefore(child, insertBefore);
53: }
54: }
|