01: /* Toolbar.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Thu Jun 23 11:33:31 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:
23: import org.zkoss.zk.ui.WrongValueException;
24: import org.zkoss.zul.impl.XulElement;
25:
26: /**
27: * A toolbar.
28: *
29: * <p>Default {@link #getSclass}: toolbox.
30: *
31: * @author tomyeh
32: */
33: public class Toolbar extends XulElement {
34: private String _orient = "horizontal";
35:
36: public Toolbar() {
37: setSclass("toolbar");
38: }
39:
40: /**
41: * @param orient either "horizontal" or "vertical".
42: */
43: public Toolbar(String orient) {
44: this ();
45: setOrient(orient);
46: }
47:
48: /** Returns the orient.
49: * <p>Default: "horizontal".
50: */
51: public String getOrient() {
52: return _orient;
53: }
54:
55: /** Sets the orient.
56: * @param orient either "horizontal" or "vertical".
57: */
58: public void setOrient(String orient) throws WrongValueException {
59: if (!"horizontal".equals(orient) && !"vertical".equals(orient))
60: throw new WrongValueException("orient cannot be " + orient);
61:
62: if (!Objects.equals(_orient, orient)) {
63: _orient = orient;
64: invalidate();
65: }
66: }
67:
68: //-- super --//
69: public String getOuterAttrs() {
70: final String attrs = super .getOuterAttrs();
71: final String clkattrs = getAllOnClickAttrs(false);
72: return clkattrs == null ? attrs : attrs + clkattrs;
73: }
74: }
|