01: /* Treecols.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Wed Jul 6 18:55:52 2005, Created by tomyeh
10: }}IS_NOTE
11:
12: Copyright (C) 2005 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.HeadersElement;
25:
26: /**
27: * A treecols.
28: *
29: * @author tomyeh
30: */
31: public class Treecols extends HeadersElement {
32: /** Returns the tree that it belongs to.
33: * <p>It is the same as {@link #getParent}.
34: */
35: public Tree getTree() {
36: return (Tree) getParent();
37: }
38:
39: public boolean setVisible(boolean visible) {
40: final boolean vis = super .setVisible(visible);
41: final Tree tree = getTree();
42: if (tree != null)
43: tree.invalidate();
44: return vis;
45: }
46:
47: //-- Component --//
48: public void setParent(Component parent) {
49: if (parent != null && !(parent instanceof Tree))
50: throw new UiException("Wrong parent: " + parent);
51: super .setParent(parent);
52: }
53:
54: public boolean insertBefore(Component child, Component insertBefore) {
55: if (!(child instanceof Treecol))
56: throw new UiException("Unsupported child for treecols: "
57: + child);
58: return super.insertBefore(child, insertBefore);
59: }
60: }
|