KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > IInformationControl


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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.text;
13
14
15 import org.eclipse.swt.events.DisposeListener;
16 import org.eclipse.swt.events.FocusListener;
17 import org.eclipse.swt.graphics.Color;
18 import org.eclipse.swt.graphics.Point;
19
20
21 /**
22  * Interface of a control presenting information. The information is given in
23  * the form of an input object. It can be either the content itself or a
24  * description of the content. The specification of what is required from an
25  * input object is left to the implementers of this interface.
26  * <p>
27  * <em>If this information control is used by a {@link AbstractHoverInformationControlManager}
28  * then that manager will own this control and override any properties that
29  * may have been set before by any other client.</em></p>
30  * <p>
31  * The information control may not grab focus when made visible using
32  * <code>setVisible(true)</code>.
33  *
34  * In order to provide backward compatibility for clients of
35  * <code>IInformationControl</code>, extension interfaces are used as a means
36  * of evolution. The following extension interfaces exist:
37  * <ul>
38  * <li>{@link org.eclipse.jface.text.IInformationControlExtension} since
39  * version 2.0 introducing the predicate of whether the control has anything to
40  * show or would be empty</li>
41  * <li>{@link org.eclipse.jface.text.IInformationControlExtension2} since
42  * version 2.1 replacing the original concept of textual input by general input
43  * objects.</li>
44  * <li>{@link org.eclipse.jface.text.IInformationControlExtension3} since
45  * version 3.0 providing access to the control's bounds and introducing
46  * the concept of persistent size and location.</li>
47  * <li>{@link org.eclipse.jface.text.IInformationControlExtension4} since
48  * version 3.3, adding API which allows to set this information control's status field text.</li>
49  * </ul>
50  * <p>
51  * Clients can implements that interface and its extension interfaces or use the
52  * provided default implementation {@link org.eclipse.jface.text.DefaultInformationControl}.
53  *
54  * @see org.eclipse.jface.text.IInformationControlExtension
55  * @see org.eclipse.jface.text.IInformationControlExtension2
56  * @see org.eclipse.jface.text.IInformationControlExtension3
57  * @see org.eclipse.jface.text.IInformationControlExtension4
58  * @since 2.0
59  */

60 public interface IInformationControl {
61
62     /**
63      * Sets the information to be presented by this information control.
64      * <p>
65      * Replaced by {@link IInformationControlExtension2#setInput(Object)}.
66      *
67      * @param information the information to be presented
68      */

69     void setInformation(String JavaDoc information);
70
71     /**
72      * Sets the information control's size constraints. A constraint value of
73      * <code>-1</code> indicates no constraint. This method must be called before
74      * <code>computeSizeHint</code> is called.
75      * <p>
76      * Note: An information control which implements {@link IInformationControlExtension3}
77      * may ignore this method or use it as hint for its very first appearance.
78      * </p>
79      * @param maxWidth the maximal width of the control to present the information, or <code>-1</code> for not constraint
80      * @param maxHeight the maximal height of the control to present the information, or <code>-1</code> for not constraint
81      */

82     void setSizeConstraints(int maxWidth, int maxHeight);
83
84     /**
85      * Computes and returns a proposal for the size of this information control depending
86      * on the information to present. The method tries to honor known size constraints but might
87      * return a size that exceeds them.
88      *
89      * @return the computed size hint
90      */

91     Point computeSizeHint();
92
93     /**
94      * Controls the visibility of this information control.
95      *
96      * @param visible <code>true</code> if the control should be visible
97      */

98     void setVisible(boolean visible);
99
100     /**
101      * Sets the size of this information control.
102      *
103      * @param width the width of the control
104      * @param height the height of the control
105      */

106     void setSize(int width, int height);
107
108     /**
109      * Sets the location of this information control.
110      *
111      * @param location the location
112      */

113     void setLocation(Point location);
114
115     /**
116      * Disposes this information control.
117      */

118     void dispose();
119
120     /**
121      * Adds the given listener to the list of dispose listeners.
122      * If the listener is already registered it is not registered again.
123      *
124      * @param listener the listener to be added
125      */

126     void addDisposeListener(DisposeListener listener);
127
128     /**
129      * Removes the given listeners from the list of dispose listeners.
130      * If the listener is not registered this call has no effect.
131      *
132      * @param listener the listener to be removed
133      */

134     void removeDisposeListener(DisposeListener listener);
135
136     /**
137      * Sets the foreground color of this information control.
138      *
139      * @param foreground the foreground color of this information control
140      */

141     void setForegroundColor(Color foreground);
142
143     /**
144      * Sets the background color of this information control.
145      *
146      * @param background the background color of this information control
147      */

148     void setBackgroundColor(Color background);
149
150     /**
151      * Returns whether this information control has the focus.
152      *
153      * @return <code>true</code> when the information control has the focus otherwise <code>false</code>
154      */

155     boolean isFocusControl();
156
157     /**
158      * Sets the keyboard focus to this information control.
159      */

160     void setFocus();
161
162     /**
163      * Adds the given listener to the list of focus listeners.
164      * If the listener is already registered it is not registered again.
165      *
166      * @param listener the listener to be added
167      */

168     void addFocusListener(FocusListener listener);
169
170     /**
171      * Removes the given listeners from the list of focus listeners.
172      * If the listener is not registered this call has no affect.
173      *
174      * @param listener the listener to be removed
175      */

176     void removeFocusListener(FocusListener listener);
177 }
178
Popular Tags