KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > layout > ITrimManager


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.layout;
12
13 import java.util.List JavaDoc;
14
15 import org.eclipse.swt.SWT;
16
17 /**
18  * Allow programmatic access to the workbench window trim areas.
19  *
20  * <p>
21  * <b>Note:</b> This is highly experimental and will change between M4 and M5.
22  * For example, the current trim area IDs will be changes to Strings, amongst
23  * other things.
24  * </p>
25  *
26  * @since 3.2
27  */

28 public interface ITrimManager {
29
30     /**
31      * Trim area location.
32      */

33     public static final int TOP = SWT.TOP;
34
35     /**
36      * Trim area location.
37      */

38     public static final int BOTTOM = SWT.BOTTOM;
39
40     /**
41      * Trim area location.
42      */

43     public static final int LEFT = SWT.LEFT;
44
45     /**
46      * Trim area location.
47      */

48     public static final int RIGHT = SWT.RIGHT;
49
50     /**
51      * Trim area location.
52      */

53     public static final int NONTRIM = SWT.DEFAULT;
54
55     /**
56      * Adds the given control to the layout's trim. The same as calling
57      * addTrim(areaId, trim, null);
58      *
59      * @param trim
60      * new window trim to be added
61      * @param areaId
62      * the area ID
63      * @see #getAreaIds()
64      * @see #addTrim(int, IWindowTrim, IWindowTrim)
65      */

66     public void addTrim(int areaId, IWindowTrim trim);
67
68     /**
69      * Adds the given control to the layout's trim. Note that this must be
70      * called for every trim control. If the given widget is already a trim
71      * widget, it will be moved to the new position. Specifying a position
72      * allows a new widget to be inserted between existing trim widgets.
73      *
74      * <p>
75      * For example, this method allows the caller to say "insert this new
76      * control as trim along the bottom of the layout, to the left of this
77      * existing control".
78      * </p>
79      *
80      * @param trim
81      * new window trim to be added
82      * @param areaId
83      * the area ID
84      * @param beforeMe
85      * trim to insert before, <code>null</code> to insert at the
86      * end
87      * @see #getAreaIds()
88      */

89     public void addTrim(int areaId, IWindowTrim trim, IWindowTrim beforeMe);
90
91     /**
92      * Removes the given window trim. Note that this has no effect if window
93      * trim is not our window trim.
94      *
95      * @param toRemove
96      * a piece of trim.
97      */

98     public void removeTrim(IWindowTrim toRemove);
99
100     /**
101      * Return the window trim for a given id.
102      *
103      * @param id
104      * the id
105      * @return the window trim, or <code>null</code> if not found.
106      */

107     public IWindowTrim getTrim(String JavaDoc id);
108
109     /**
110      * Return all of the IDs for the currently supported trim areas. This is
111      * <b>experimental</b> and will be changing.
112      *
113      * @return the list of IDs that can be used with area descriptions. We
114      * currently support SWT.TOP, SWT.BOTTOM, SWT.LEFT, and SWT.RIGHT.
115      * @since 3.2
116      */

117     public int[] getAreaIds();
118
119     /**
120      * Return a copy of the IWindowTrim in an ordered array. This will not
121      * return <code>null</code>. This array can be used to shuffle items
122      * around in {@link #updateAreaTrim(int, List, boolean) }.
123      *
124      * @param areaId
125      * the trim area id
126      * @return the IWindowTrim array
127      * @since 3.2
128      * @see #getAreaIds()
129      */

130     public List JavaDoc getAreaTrim(int areaId);
131
132     /**
133      * Update ID's area description with the new window trim ordering. This
134      * applies the IWindowTrim contains in the array to the trim area named
135      * "ID".
136      *
137      * @param id
138      * the trim area ID
139      * @param trim
140      * the trim array must not be <code>null</code>.
141      * @param removeExtra
142      * if <code>true</code> the any trim in the specified trim area
143      * that's not contained in the List is removed from the window
144      * trim (but not disposed()). If <code>false</code> then the
145      * extra trim is shuffled to the beginning of the trim area.
146      * @since 3.2
147      * @see #getAreaIds()
148      */

149     public void updateAreaTrim(int id, List JavaDoc trim, boolean removeExtra);
150
151     /**
152      * This method returns an aggregate array of all trim items known to this
153      * TrimLayout.
154      *
155      * @return The List of all IWindowTrim elements
156      * @since 3.2
157      */

158     public List JavaDoc getAllTrim();
159
160     /**
161      * Update the visibility of the trim controls. It updates any docking
162      * handles as well. It has no effect on visiblity if the window trim doesn't
163      * belong to this TrimLayout.
164      *
165      * @param trim
166      * the trim to update
167      * @param visible
168      * visible or not
169      * @since 3.2
170      */

171     public void setTrimVisible(IWindowTrim trim, boolean visible);
172     
173     /**
174      * Force the trim areas to layout to pick up changes
175      *
176      * @since 3.2
177      */

178     public void forceLayout();
179 }
180
Popular Tags