01: package org.wings;
02:
03: /**
04: *
05: */
06: public class SSeparator extends SComponent {
07:
08: private static final long serialVersionUID = -6257881596567546337L;
09:
10: private static final SDimension initialDimensionH = new SDimension(
11: "100%", "1px");
12: private static final SDimension initialDimensionV = new SDimension(
13: "1px", "17px");
14:
15: private int orientation = -1;
16:
17: public SSeparator() {
18: this (SConstants.HORIZONTAL);
19: }
20:
21: public SSeparator(final int orientation) {
22: setOrientation(orientation);
23: }
24:
25: public int getOrientation() {
26: return orientation;
27: }
28:
29: public void setOrientation(final int orientation) {
30: if (isDifferent(this .orientation, orientation)) {
31: switch (orientation) {
32: case SConstants.HORIZONTAL:
33: if (getPreferredSize() == null) {
34: setPreferredSize(initialDimensionH);
35: }
36: addStyle("horizontal");
37: break;
38: case SConstants.VERTICAL:
39: if (getPreferredSize() == null) {
40: setPreferredSize(initialDimensionV);
41: }
42: addStyle("vertical");
43: break;
44: default:
45: throw new IllegalArgumentException(
46: "Orientation must be one of: HORIZONTAL, VERTICAL");
47: }
48: this.orientation = orientation;
49: reload();
50: }
51:
52: }
53:
54: }
|