01: /* HeadersElement.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Thu Dec 7 09:43:48 2006, Created by tomyeh
10: }}IS_NOTE
11:
12: Copyright (C) 2006 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.impl;
20:
21: import org.zkoss.zul.event.ZulEvents;
22:
23: /**
24: * A skeletal implementation for headers, the parent of
25: * a group of {@link HeaderElement}.
26: *
27: * @author tomyeh
28: */
29: abstract public class HeadersElement extends XulElement {
30: private boolean _sizable;
31:
32: /** Returns whether the width of the child column is sizable.
33: */
34: public boolean isSizable() {
35: return _sizable;
36: }
37:
38: /** Sets whether the width of the child column is sizable.
39: * If true, an user can drag the border between two columns (e.g., {@link org.zkoss.zul.Column})
40: * to change the widths of adjacent columns.
41: * <p>Default: false.
42: */
43: public void setSizable(boolean sizable) {
44: if (_sizable != sizable) {
45: _sizable = sizable;
46: smartUpdate("z.sizable", sizable);
47: }
48: }
49:
50: //super//
51: public String getOuterAttrs() {
52: StringBuffer sb = _sizable ? new StringBuffer(80) : null;
53: sb = appendAsapAttr(sb, ZulEvents.ON_COL_SIZE);
54:
55: final String attrs = super .getOuterAttrs();
56: if (sb == null)
57: return attrs;
58:
59: sb.append(attrs);
60: if (_sizable)
61: sb.append(" z.sizable=\"true\"");
62: return sb.toString();
63: }
64: }
|