%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.commons.jelly.tags.swing.EmptyBorderTag |
|
|
1 | /* |
|
2 | * Copyright 2002,2004 The Apache Software Foundation. |
|
3 | * |
|
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 | * you may not use this file except in compliance with the License. |
|
6 | * You may obtain a copy of the License at |
|
7 | * |
|
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
9 | * |
|
10 | * Unless required by applicable law or agreed to in writing, software |
|
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 | * See the License for the specific language governing permissions and |
|
14 | * limitations under the License. |
|
15 | */ |
|
16 | package org.apache.commons.jelly.tags.swing; |
|
17 | ||
18 | import javax.swing.BorderFactory; |
|
19 | import javax.swing.border.Border; |
|
20 | ||
21 | import org.apache.commons.jelly.JellyTagException; |
|
22 | import org.apache.commons.jelly.MissingAttributeException; |
|
23 | import org.apache.commons.jelly.XMLOutput; |
|
24 | import org.apache.commons.logging.Log; |
|
25 | import org.apache.commons.logging.LogFactory; |
|
26 | ||
27 | /** |
|
28 | * Creates an empty border. |
|
29 | * The border will either be exported as a variable defined by the 'var' attribute |
|
30 | * or will be set on the parent widget's border property |
|
31 | * |
|
32 | * @author <a href="mailto:robert@bull-enterprises.com">Robert McIntosh</a> |
|
33 | * @version $Revision: 155420 $ |
|
34 | */ |
|
35 | 0 | public class EmptyBorderTag extends BorderTagSupport { |
36 | ||
37 | /** The Log to which logging calls will be made. */ |
|
38 | 8 | private static final Log log = LogFactory.getLog(EmptyBorderTag.class); |
39 | ||
40 | 0 | private int left = -1; |
41 | 0 | private int right = -1; |
42 | 0 | private int top = -1; |
43 | 0 | private int bottom = -1; |
44 | ||
45 | // Tag interface |
|
46 | //------------------------------------------------------------------------- |
|
47 | public void doTag(final XMLOutput output) throws MissingAttributeException, JellyTagException { |
|
48 | 0 | if ( left == -1) { |
49 | 0 | throw new MissingAttributeException("left"); |
50 | } |
|
51 | 0 | if ( right == -1) { |
52 | 0 | throw new MissingAttributeException("right"); |
53 | } |
|
54 | 0 | if ( top == -1) { |
55 | 0 | throw new MissingAttributeException("top"); |
56 | } |
|
57 | 0 | if ( bottom == -1) { |
58 | 0 | throw new MissingAttributeException("bottom"); |
59 | } |
|
60 | 0 | super.doTag(output); |
61 | 0 | } |
62 | ||
63 | // Properties |
|
64 | //------------------------------------------------------------------------- |
|
65 | /** |
|
66 | * Sets the left inset |
|
67 | * @param left |
|
68 | */ |
|
69 | public void setLeft( int left ) { |
|
70 | 0 | this.left = left; |
71 | 0 | } |
72 | ||
73 | /** |
|
74 | * Sets the right inset |
|
75 | * @param right |
|
76 | */ |
|
77 | public void setRight( int right ) { |
|
78 | 0 | this.right = right; |
79 | 0 | } |
80 | ||
81 | /** |
|
82 | * Sets the top inset |
|
83 | * @param top |
|
84 | */ |
|
85 | public void setTop( int top ) { |
|
86 | 0 | this.top = top; |
87 | 0 | } |
88 | ||
89 | /** |
|
90 | * Sets the bottom inset |
|
91 | * @param bottom |
|
92 | */ |
|
93 | public void setBottom( int bottom ) { |
|
94 | 0 | this.bottom = bottom; |
95 | 0 | } |
96 | ||
97 | /** |
|
98 | * Factory method to create a new EmptyBorder instance. |
|
99 | */ |
|
100 | protected Border createBorder() { |
|
101 | 0 | return BorderFactory.createEmptyBorder( top, left, bottom, right); |
102 | } |
|
103 | ||
104 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |