KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > menus > AbstractTrimWidget


1 /*******************************************************************************
2  * Copyright (c) 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
12 package org.eclipse.jface.menus;
13
14 import org.eclipse.swt.SWT;
15 import org.eclipse.swt.widgets.Composite;
16 import org.eclipse.swt.widgets.CoolBar;
17 import org.eclipse.swt.widgets.Menu;
18 import org.eclipse.swt.widgets.ToolBar;
19
20 /**
21  * This extension to the {@link IWidget} interface allows clients adding
22  * elements to the trim to receive notifications if the User moves the widget to
23  * another trim area.
24  * <p>
25  * This class is intended to be the base for any trim contributions.
26  * </p>
27  * @since 3.2
28  *
29  */

30 public abstract class AbstractTrimWidget implements IWidget {
31     /**
32      * This method is called to initially construct the widget and is also
33      * called whenever the widget's composite has been moved to a trim area on a
34      * different side of the workbench. It is the client's responsibility to
35      * control the life-cycle of the Control it manages.
36      * <p>
37      * For example: If the implementation is constructing a {@link ToolBar} and
38      * the orientation were to change from horizontal to vertical it would have
39      * to <code>dispose</code> its old ToolBar and create a new one with the
40      * correct orientation.
41      * </p>
42      * <p>
43      * The sides can be one of:
44      * <ul>
45      * <li>{@link SWT#TOP}</li>
46      * <li>{@link SWT#BOTTOM}</li>
47      * <li>{@link SWT#LEFT}</li>
48      * <li>{@link SWT#RIGHT}</li>
49      * </ul>
50      * </p>
51      * <p>
52      *
53      * @param parent
54      * The parent to (re)create the widget under
55      *
56      * @param oldSide
57      * The previous side ({@link SWT#DEFAULT} on the initial fill)
58      * @param newSide
59      * The current side
60      */

61     public abstract void fill(Composite parent, int oldSide, int newSide);
62
63     /* (non-Javadoc)
64      * @see org.eclipse.jface.menus.IWidget#dispose()
65      */

66     public abstract void dispose();
67
68     /* (non-Javadoc)
69      * @see org.eclipse.jface.menus.IWidget#fill(org.eclipse.swt.widgets.Composite)
70      */

71     public void fill(Composite parent) {
72     }
73
74     /* (non-Javadoc)
75      * @see org.eclipse.jface.menus.IWidget#fill(org.eclipse.swt.widgets.Menu, int)
76      */

77     public void fill(Menu parent, int index) {
78     }
79
80     /* (non-Javadoc)
81      * @see org.eclipse.jface.menus.IWidget#fill(org.eclipse.swt.widgets.ToolBar, int)
82      */

83     public void fill(ToolBar parent, int index) {
84     }
85
86     /* (non-Javadoc)
87      * @see org.eclipse.jface.menus.IWidget#fill(org.eclipse.swt.widgets.CoolBar, int)
88      */

89     public void fill(CoolBar parent, int index) {
90     }
91 }
92
Popular Tags