KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > menus > SLayout


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.menus;
12
13 /**
14  * <p>
15  * A layout for a widget element. The layout contains information allowing the
16  * workbench layout algorithm to manage the amount of space allocated to a
17  * particular trim widget.
18  * </p>
19  * <p>
20  * There are two boolean values defined in this element:
21  * <ul>
22  * <li><b>fillMajor</b>: If <code>true</code> then the layout will 'stretch'
23  * the widget to use up extra space along the <i>major</i> dimension.</li>
24  * <li><b>fillMinor</b>: If <code>true</code> then the layout will 'stretch'
25  * the widget to use up extra space along the <i>minor</i> dimension.</li>
26  * </ul>
27  * </p>
28  * <p>
29  * <b>NOTE</b>: The 'major' dimension is "X" (horiontal) for trim areas at the
30  * top or bottom of the workbench and "Y" (vertical) for trim areas on the sides
31  * of the workbench.
32  * </p>
33  * <p>
34  * Clients may instantiate this class, but must not extend.
35  * </p>
36  * <p>
37  * <strong>PROVISIONAL</strong>. This class or interface has been added as part
38  * of a work in progress. There is a guarantee neither that this API will work
39  * nor that it will remain the same. Please do not use this API without
40  * consulting with the Platform/UI team.
41  * </p>
42  * <p>
43  * This class will eventually exist in <code>org.eclipse.jface.menus</code>.
44  * </p>
45  *
46  * @since 3.2
47  */

48 public final class SLayout {
49
50     /**
51      * The value of the 'fillMajor' attribute
52      */

53     private final boolean fillMajor;
54
55     /**
56      * The value of the 'fillMinor' attribute
57      */

58     private final boolean fillMinor;
59
60     /**
61      * Constructs a new instance of <code>SLayout</code> -- indicating no fill
62      * is desired in either dimension.
63      */

64     public SLayout() {
65         this(false, false);
66     }
67
68     /**
69      * Constructs a new instance of <code>SLayout</code> -- capturing the fill
70      * values as given.
71      *
72      * @param fillMajor
73      * <code>true</code> if the layout will 'stretch' the widget to
74      * use up extra space along the <i>major</i> dimension.
75      * @param fillMinor
76      * <code>true</code> if the layout will 'stretch' the widget to
77      * use up extra space along the <i>minor</i> dimension.
78      */

79     public SLayout(final boolean fillMajor, final boolean fillMinor) {
80         this.fillMajor = fillMajor;
81         this.fillMinor = fillMinor;
82     }
83
84     /**
85      * Returns whether the widget should fill all available space along the
86      * major axis.
87      *
88      * @return Returns the fillMajor value.
89      */

90     public boolean fillMajor() {
91         return fillMajor;
92     }
93
94     /**
95      * Returns whether the widget should fill all available space along the
96      * minor axis.
97      *
98      * @return Returns the fillMinor value.
99      */

100     public boolean fillMinor() {
101         return fillMinor;
102     }
103
104     public final String JavaDoc toString() {
105         final StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
106         buffer.append("SLayout("); //$NON-NLS-1$
107
buffer.append(fillMajor);
108         buffer.append(',');
109         buffer.append(fillMinor);
110         buffer.append(')');
111         return buffer.toString();
112     }
113 }
114
Popular Tags