~ubuntu-branches/ubuntu/trusty/libjgoodies-forms-java/trusty

« back to all changes in this revision

Viewing changes to src/main/com/jgoodies/forms/util/MacLayoutStyle.java

  • Committer: Bazaar Package Importer
  • Author(s): Eric Lavarde
  • Date: 2006-03-23 20:54:19 UTC
  • Revision ID: james.westby@ubuntu.com-20060323205419-emo7oazp2lspvl3b
Tags: upstream-1.0.5
ImportĀ upstreamĀ versionĀ 1.0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2002-2004 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
import com.jgoodies.forms.layout.Sizes;
 
36
 
 
37
/**
 
38
 * A {@link LayoutStyle} that aims to provide layout constants as defined by
 
39
 * Microsoft's <i>Design Specifications and Guidelines - Visual Design</i>.
 
40
 *
 
41
 * @author Karsten Lentzsch
 
42
 * @version $Revision: 1.3 $
 
43
 */
 
44
 
 
45
final class MacLayoutStyle extends LayoutStyle {
 
46
    
 
47
    static final MacLayoutStyle INSTANCE = new MacLayoutStyle();
 
48
    
 
49
    private MacLayoutStyle() {
 
50
        // Suppresses default constructor, ensuring non-instantiability.
 
51
    }
 
52
    
 
53
 
 
54
    // Component Sizes ******************************************************
 
55
 
 
56
    private static final Size         BUTTON_WIDTH              = Sizes.dluX(39);
 
57
    private static final Size         BUTTON_HEIGHT             = Sizes.dluY(14);
 
58
    
 
59
 
 
60
    // Gaps ******************************************************************
 
61
 
 
62
    private static final ConstantSize DIALOG_MARGIN_X           = Sizes.DLUX9;
 
63
    private static final ConstantSize DIALOG_MARGIN_Y           = Sizes.DLUY9;
 
64
    
 
65
    private static final ConstantSize TABBED_DIALOG_MARGIN_X    = Sizes.DLUX4;
 
66
    private static final ConstantSize TABBED_DIALOG_MARGIN_Y    = Sizes.DLUY4;
 
67
    
 
68
    private static final ConstantSize LABEL_COMPONENT_PADX      = Sizes.DLUX3;
 
69
    private static final ConstantSize RELATED_COMPONENTS_PADX   = Sizes.DLUX4;
 
70
    private static final ConstantSize UNRELATED_COMPONENTS_PADX = Sizes.DLUX8;
 
71
    
 
72
    private static final ConstantSize RELATED_COMPONENTS_PADY   = Sizes.DLUY3;
 
73
    private static final ConstantSize UNRELATED_COMPONENTS_PADY = Sizes.DLUY6;
 
74
    private static final ConstantSize NARROW_LINE_PAD           = Sizes.DLUY2;
 
75
    private static final ConstantSize LINE_PAD                  = Sizes.DLUY3;
 
76
    private static final ConstantSize PARAGRAPH_PAD             = Sizes.DLUY9;
 
77
    private static final ConstantSize BUTTON_BAR_PAD            = Sizes.DLUY4;
 
78
    
 
79
 
 
80
    // Layout Sizes *********************************************************
 
81
 
 
82
    /**
 
83
     * Returns this style's default button width.
 
84
     * 
 
85
     * @return the default button width
 
86
     * 
 
87
     * @see #getDefaultButtonHeight()
 
88
     */
 
89
    public Size getDefaultButtonWidth() {
 
90
        return BUTTON_WIDTH;
 
91
    }
 
92
 
 
93
    
 
94
    /**
 
95
     * Returns this style's default button height.
 
96
     * 
 
97
     * @return the default button height
 
98
     * 
 
99
     * @see #getDefaultButtonWidth()
 
100
     */
 
101
    public Size getDefaultButtonHeight() {
 
102
        return BUTTON_HEIGHT;
 
103
    }
 
104
 
 
105
    
 
106
    /**
 
107
     * Returns this style's horizontal margin for general dialogs.
 
108
     * 
 
109
     * @return the horizontal margin for general dialogs
 
110
     * 
 
111
     * @see #getDialogMarginY()
 
112
     * @see #getTabbedDialogMarginX()
 
113
     */
 
114
    public ConstantSize getDialogMarginX() {
 
115
        return DIALOG_MARGIN_X;
 
116
    }
 
117
    
 
118
 
 
119
    /**
 
120
     * Returns this style's vertical margin for general dialogs.
 
121
     * 
 
122
     * @return the vertical margin for general dialogs
 
123
     * 
 
124
     * @see #getDialogMarginX()
 
125
     * @see #getTabbedDialogMarginY()
 
126
     */
 
127
    public ConstantSize getDialogMarginY() {
 
128
        return DIALOG_MARGIN_Y;
 
129
    }
 
130
 
 
131
    
 
132
    /**
 
133
     * Returns this style's horizontal margin for dialogs that consist of 
 
134
     * a tabbed pane.
 
135
     * 
 
136
     * @return the horizontal margin for dialogs that consist of a tabbed pane
 
137
     * @since 1.0.3
 
138
     * 
 
139
     * @see #getTabbedDialogMarginY()
 
140
     * @see #getDialogMarginX()
 
141
     */
 
142
    public ConstantSize getTabbedDialogMarginX() {
 
143
        return TABBED_DIALOG_MARGIN_X;
 
144
    }
 
145
 
 
146
    
 
147
    /**
 
148
     * Returns this style's vertical margin for dialogs that consist of
 
149
     * a tabbed pane.
 
150
     * 
 
151
     * @return the vertical margin for dialogs that consist of a tabbed pane
 
152
     * @since 1.0.3
 
153
     * 
 
154
     * @see #getTabbedDialogMarginX()
 
155
     * @see #getDialogMarginY()
 
156
     */
 
157
    public ConstantSize getTabbedDialogMarginY() {
 
158
        return TABBED_DIALOG_MARGIN_Y;
 
159
    }
 
160
 
 
161
    
 
162
    /**
 
163
     * Returns a gap used to separate a label and associated control.
 
164
     * 
 
165
     * @return a gap between label and associated control
 
166
     * 
 
167
     * @see #getRelatedComponentsPadX()
 
168
     * @see #getUnrelatedComponentsPadX()
 
169
     */
 
170
    public ConstantSize getLabelComponentPadX() {
 
171
        return LABEL_COMPONENT_PADX;
 
172
    }
 
173
 
 
174
    
 
175
    /**
 
176
     * Returns a horizontal gap used to separate related controls.
 
177
     * 
 
178
     * @return a horizontal gap between related controls
 
179
     * 
 
180
     * @see #getLabelComponentPadX()
 
181
     * @see #getRelatedComponentsPadY()
 
182
     * @see #getUnrelatedComponentsPadX()
 
183
     */
 
184
    public ConstantSize getRelatedComponentsPadX() {
 
185
        return RELATED_COMPONENTS_PADX;
 
186
    }
 
187
 
 
188
    
 
189
    /**
 
190
     * Returns a vertical gap used to separate related controls.
 
191
     * 
 
192
     * @return a vertical gap between related controls
 
193
     * 
 
194
     * @see #getRelatedComponentsPadX()
 
195
     * @see #getUnrelatedComponentsPadY()
 
196
     */
 
197
    public ConstantSize getRelatedComponentsPadY() {
 
198
        return RELATED_COMPONENTS_PADY;
 
199
    }
 
200
 
 
201
    
 
202
    /**
 
203
     * Returns a horizontal gap used to separate unrelated controls.
 
204
     * 
 
205
     * @return a horizontal gap between unrelated controls
 
206
     * 
 
207
     * @see #getLabelComponentPadX()
 
208
     * @see #getUnrelatedComponentsPadY()
 
209
     * @see #getRelatedComponentsPadX()
 
210
     */
 
211
    public ConstantSize getUnrelatedComponentsPadX() {
 
212
        return UNRELATED_COMPONENTS_PADX;
 
213
    }
 
214
 
 
215
    
 
216
    /**
 
217
     * Returns a vertical gap used to separate unrelated controls.
 
218
     * 
 
219
     * @return a vertical gap between unrelated controls
 
220
     * 
 
221
     * @see #getUnrelatedComponentsPadX()
 
222
     * @see #getRelatedComponentsPadY()
 
223
     */
 
224
    public ConstantSize getUnrelatedComponentsPadY() {
 
225
        return UNRELATED_COMPONENTS_PADY;
 
226
    }
 
227
 
 
228
    
 
229
    /**
 
230
     * Returns a narrow vertical pad used to separate lines.
 
231
     * 
 
232
     * @return a narrow vertical pad used to separate lines
 
233
     * 
 
234
     * @see #getLinePad()
 
235
     * @see #getParagraphPad()
 
236
     */
 
237
    public ConstantSize getNarrowLinePad() {
 
238
        return NARROW_LINE_PAD;
 
239
    }
 
240
 
 
241
    
 
242
    /**
 
243
     * Returns a narrow vertical pad used to separate lines.
 
244
     * 
 
245
     * @return a vertical pad used to separate lines
 
246
     * 
 
247
     * @see #getNarrowLinePad()
 
248
     * @see #getParagraphPad()
 
249
     */
 
250
    public ConstantSize getLinePad() {
 
251
        return LINE_PAD;
 
252
    }
 
253
 
 
254
    
 
255
    /**
 
256
     * Returns a pad used to separate paragraphs.
 
257
     * 
 
258
     * @return a vertical pad used to separate paragraphs
 
259
     * 
 
260
     * @see #getNarrowLinePad()
 
261
     * @see #getLinePad()
 
262
     */
 
263
    public ConstantSize getParagraphPad() {
 
264
        return PARAGRAPH_PAD;
 
265
    }
 
266
    
 
267
    
 
268
    /**
 
269
     * Returns a pad used to separate a button bar from a component.
 
270
     * 
 
271
     * @return a vertical pad used to separate paragraphs
 
272
     * @since 1.0.3
 
273
     * 
 
274
     * @see #getRelatedComponentsPadY()
 
275
     * @see #getUnrelatedComponentsPadY()
 
276
     */
 
277
    public ConstantSize getButtonBarPad() {
 
278
        return BUTTON_BAR_PAD;
 
279
    }
 
280
 
 
281
    
 
282
    /**
 
283
     * Checks and answers whether buttons are typically ordered from 
 
284
     * left to right or from right to left. Useful for building button bars 
 
285
     * that shall comply with the platform's layout style guide.<p>
 
286
     * 
 
287
     * For example the Windows style guide recommends to layout out
 
288
     * <em>OK, Cancel, Apply</em> from left to right, where the 
 
289
     * Mac Aqua style guide recommends to layout out these buttons
 
290
     * from right to left.<p>
 
291
     * 
 
292
     * Although most button sequences shall honor this order
 
293
     * some buttons require a left to right order. For example
 
294
     * <em>Back, Next</em> or <em>Move Left, Move Right</em>.<p>
 
295
     * 
 
296
     * @return true if buttons are typically ordered from left to right
 
297
     * @since 1.0.3
 
298
     * 
 
299
     * @see com.jgoodies.forms.builder.ButtonBarBuilder
 
300
     * @see com.jgoodies.forms.factories.ButtonBarFactory
 
301
     */
 
302
    public boolean isLeftToRightButtonOrder() {
 
303
        return false;
 
304
    }
 
305
    
 
306
 
 
307
}
 
 
b'\\ No newline at end of file'