1
2
3
4
5
6
7
8
9
10
11 package de.jaret.util.ui.table.renderer;
12
13 import java.util.StringTokenizer;
14
15 /***
16 * Default implementation of a BorderConfiguration.
17 *
18 * @author Peter Kliem
19 * @version $Id: DefaultBorderConfiguration.java 361 2007-04-09 15:43:38Z olk $
20 */
21 public class DefaultBorderConfiguration implements IBorderConfiguration {
22 /*** left border. */
23 protected int _borderLeft;
24 /*** right border. */
25 protected int _borderRight;
26 /*** top border. */
27 protected int _borderTop;
28 /*** bottom border. */
29 protected int _borderBottom;
30
31 /***
32 * Construct a border configuration.
33 *
34 * @param left left border
35 * @param right right border
36 * @param top top border
37 * @param bottom bottom border
38 */
39 public DefaultBorderConfiguration(int left, int right, int top, int bottom) {
40 _borderBottom = bottom;
41 _borderLeft = left;
42 _borderRight = right;
43 _borderTop = top;
44 }
45
46 /***
47 * Construct a borderconfiguration form a comma separated string holding the values (no error hndling).
48 *
49 * @param str csv string
50 */
51 public DefaultBorderConfiguration(String str) {
52 StringTokenizer tokenizer = new StringTokenizer(str, ",");
53 _borderLeft = Integer.parseInt(tokenizer.nextToken());
54 _borderRight = Integer.parseInt(tokenizer.nextToken());
55 _borderTop = Integer.parseInt(tokenizer.nextToken());
56 _borderBottom = Integer.parseInt(tokenizer.nextToken());
57 }
58
59 /***
60 * {@inheritDoc}
61 */
62 public DefaultBorderConfiguration copy() {
63 DefaultBorderConfiguration bc = new DefaultBorderConfiguration(_borderLeft, _borderRight, _borderTop,
64 _borderBottom);
65 return bc;
66 }
67
68 /***
69 * {@inheritDoc} Produces a string that can be passed to the constructor as a csv string.
70 */
71 public String toString() {
72 return _borderLeft + "," + _borderRight + "," + _borderTop + "," + _borderBottom;
73 }
74
75 /***
76 * @return Returns the borderBottom.
77 */
78 public int getBorderBottom() {
79 return _borderBottom;
80 }
81
82 /***
83 * @param borderBottom The borderBottom to set.
84 */
85 public void setBorderBottom(int borderBottom) {
86 _borderBottom = borderBottom;
87 }
88
89 /***
90 * @return Returns the borderLeft.
91 */
92 public int getBorderLeft() {
93 return _borderLeft;
94 }
95
96 /***
97 * @param borderLeft The borderLeft to set.
98 */
99 public void setBorderLeft(int borderLeft) {
100 _borderLeft = borderLeft;
101 }
102
103 /***
104 * @return Returns the borderRight.
105 */
106 public int getBorderRight() {
107 return _borderRight;
108 }
109
110 /***
111 * @param borderRight The borderRight to set.
112 */
113 public void setBorderRight(int borderRight) {
114 _borderRight = borderRight;
115 }
116
117 /***
118 * @return Returns the borderTop.
119 */
120 public int getBorderTop() {
121 return _borderTop;
122 }
123
124 /***
125 * @param borderTop The borderTop to set.
126 */
127 public void setBorderTop(int borderTop) {
128 _borderTop = borderTop;
129 }
130
131 }