01: /* Div.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Fri Dec 30 17:49:49 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.lang.Objects;
22: import org.zkoss.xml.HTMLs;
23: import org.zkoss.zul.impl.XulElement;
24:
25: /**
26: * The same as HTML DIV tag.
27: *
28: * <p>An extension. It has the same effect as
29: * <code><h:div xmlns:h="http://www.w3.org/1999/xhtml"></code>.
30: * Note: a {@link Window} without title and caption has the same visual effect
31: * as {@link Div}, but {@link Div} doesn't implement IdSpace.
32: * In other words, {@link Div} won't affect the uniqueness of identifiers.
33: *
34: * @author tomyeh
35: */
36: public class Div extends XulElement {
37: private String _align;
38:
39: /** Returns the alignment.
40: * <p>Default: null (use browser default).
41: */
42: public String getAlign() {
43: return _align;
44: }
45:
46: /** Sets the alignment: one of left, center, right, ustify,
47: */
48: public void setAlign(String align) {
49: if (align != null && align.length() == 0)
50: align = null;
51:
52: if (!Objects.equals(_align, align)) {
53: _align = align;
54: smartUpdate("align", _align);
55: }
56: }
57:
58: //-- super --//
59: public String getOuterAttrs() {
60: final String clkattrs = getAllOnClickAttrs(false);
61: final String attrs = super .getOuterAttrs();
62: if (_align == null && clkattrs == null)
63: return attrs;
64:
65: final StringBuffer sb = new StringBuffer(80).append(attrs);
66: HTMLs.appendAttribute(sb, "align", _align);
67: if (clkattrs != null)
68: sb.append(clkattrs);
69: return sb.toString();
70: }
71: }
|