KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jgoodies > forms > util > LayoutStyle


1 /*
2  * Copyright (c) 2003 JGoodies Karsten Lentzsch. All Rights Reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * o Redistributions of source code must retain the above copyright notice,
8  * this list of conditions and the following disclaimer.
9  *
10  * o Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  *
14  * o Neither the name of JGoodies Karsten Lentzsch nor the names of
15  * its contributors may be used to endorse or promote products derived
16  * from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */

30
31 package com.jgoodies.forms.util;
32
33 import com.jgoodies.forms.layout.ConstantSize;
34 import com.jgoodies.forms.layout.Size;
35
36 /**
37  * An abstract class that describes a layout and design style guide.
38  * It provides constants used to layout panels consistently.
39  * <p>
40  * This class is work in progress and the API may change without notice.
41  * Therefore it is recommended to not write custom subclasses
42  * for production code.
43  * A future version of this class will likely collaborate with a class
44  * <code>LogicalSize</code> or <code>StyledSize</code>.
45  *
46  * @author Karsten Lentzsch
47  * @version $Revision: 1.2 $
48  */

49
50 public abstract class LayoutStyle {
51     
52     /**
53      * Holds the current layout style.
54      */

55     private static LayoutStyle current = WindowsLayoutStyle.INSTANCE;
56     
57     
58     // Accessing the current style ******************************************
59

60     /**
61      * Returns the current <code>LayoutStyle</code>.
62      *
63      * @return the current <code>LayoutStyle</code>
64      */

65     public static LayoutStyle getCurrent() {
66         return current;
67     }
68     
69     /**
70      * Set a new <code>LayoutStyle</code>
71      */

72     public static void setCurrent(LayoutStyle newLayoutStyle) {
73         current = newLayoutStyle;
74     }
75     
76     
77     // Layout Sizes *********************************************************
78

79     /**
80      * Answers the style's default button width.
81      *
82      * @return the default button width
83      */

84     abstract public Size getDefaultButtonWidth();
85
86     /**
87      * Answers the style's default button height.
88      *
89      * @return the default button height
90      */

91     abstract public Size getDefaultButtonHeight();
92
93     /**
94      * Answers the style's horizontal dialog margin.
95      *
96      * @return the horizontal dialog margin
97      */

98     abstract public ConstantSize getDialogMarginX();
99
100     /**
101      * Answers the style's vertical dialog margin.
102      *
103      * @return the vertical dialog margin
104      */

105     abstract public ConstantSize getDialogMarginY();
106
107     /**
108      * Answers a gap used to separate a label and associated control.
109      *
110      * @return a gap between label and associated control
111      */

112     abstract public ConstantSize getLabelComponentPadX();
113
114     /**
115      * Answers a horizontal gap used to separate related controls.
116      *
117      * @return a horizontal gap between related controls
118      */

119     abstract public ConstantSize getRelatedComponentsPadX();
120
121     /**
122      * Answers a vertical gap used to separate related controls.
123      *
124      * @return a vertical gap between related controls
125      */

126     abstract public ConstantSize getRelatedComponentsPadY();
127
128     /**
129      * Answers a horizontal gap used to separate unrelated controls.
130      *
131      * @return a horizontal gap between unrelated controls
132      */

133     abstract public ConstantSize getUnrelatedComponentsPadX();
134
135     /**
136      * Answers a vertical gap used to separate unrelated controls.
137      *
138      * @return a vertical gap between unrelated controls
139      */

140     abstract public ConstantSize getUnrelatedComponentsPadY();
141
142     /**
143      * Answers a narrow vertical pad used to separate lines.
144      *
145      * @return a vertical pad used to separate lines
146      */

147     abstract public ConstantSize getLinePad();
148
149     /**
150      * Answers a narrow vertical pad used to separate lines.
151      *
152      * @return a narrow vertical pad used to separate lines
153      */

154     abstract public ConstantSize getNarrowLinePad();
155
156     /**
157      * Answers a pad used to paragraphs.
158      *
159      * @return a vertical pad used to separate paragraphs
160      */

161     abstract public ConstantSize getParagraphPad();
162
163 }
Popular Tags