Eclipse Platform
Release 3.0

org.eclipse.jface.text
Class DefaultInformationControl

java.lang.Object
  extended byorg.eclipse.jface.text.DefaultInformationControl
All Implemented Interfaces:
DisposeListener, EventListener, IInformationControl, IInformationControlExtension, IInformationControlExtension3, org.eclipse.swt.internal.SWTEventListener

public class DefaultInformationControl
extends Object
implements IInformationControl, IInformationControlExtension, IInformationControlExtension3, DisposeListener

Default implementation of IInformationControl.

Displays textual information in a StyledText widget. Before displaying, the information set to this information control is processed by an IInformationPresenter.

Since:
2.0

Nested Class Summary
static interface DefaultInformationControl.IInformationPresenter
          An information presenter determines the style presentation of information displayed in the default information control.
 
Constructor Summary
DefaultInformationControl(Shell parent)
          Creates a default information control with the given shell as parent.
DefaultInformationControl(Shell parent, DefaultInformationControl.IInformationPresenter presenter)
          Creates a default information control with the given shell as parent.
DefaultInformationControl(Shell parent, int style, DefaultInformationControl.IInformationPresenter presenter)
          Creates a default information control with the given shell as parent.
DefaultInformationControl(Shell parent, int style, DefaultInformationControl.IInformationPresenter presenter, String statusFieldText)
          Creates a default information control with the given shell as parent.
DefaultInformationControl(Shell parent, int shellStyle, int style, DefaultInformationControl.IInformationPresenter presenter)
          Creates a default information control with the given shell as parent.
DefaultInformationControl(Shell parent, int shellStyle, int style, DefaultInformationControl.IInformationPresenter presenter, String statusFieldText)
          Creates a default information control with the given shell as parent.
 
Method Summary
 void addDisposeListener(DisposeListener listener)
          Adds the given listener to the list of dispose listeners.
 void addFocusListener(FocusListener listener)
          Adds the given listener to the list of focus listeners.
 Point computeSizeHint()
          Computes and returns a proposal for the size of this information control depending on the information to present.
 Rectangle computeTrim()
          Computes the trim for this control.
 void dispose()
          Disposes this information control.
 Rectangle getBounds()
          Returns a rectangle describing the receiver's size and location relative to its parent (or its display if its parent is null).
 boolean hasContents()
          Returns whether this information control has contents to be displayed.
 boolean isFocusControl()
          Returns whether this information control has the focus.
 void removeDisposeListener(DisposeListener listener)
          Removes the given listeners from the list of dispose listeners.
 void removeFocusListener(FocusListener listener)
          Removes the given listeners from the list of focus listeners.
 boolean restoresLocation()
          Tells whether this control allows to restore the previously used location.
 boolean restoresSize()
          Tells whether this control allows to restore the previously used size.
 void setBackgroundColor(Color background)
          Sets the background color of this information control.
 void setFocus()
          Sets the keyboard focus to this information control.
 void setForegroundColor(Color foreground)
          Sets the foreground color of this information control.
 void setInformation(String content)
          Sets the information to be presented by this information control.
 void setLocation(Point location)
          Sets the location of this information control.
 void setSize(int width, int height)
          Sets the size of this information control.
 void setSizeConstraints(int maxWidth, int maxHeight)
          Sets the information control's size constraints.
 void setVisible(boolean visible)
          Controls the visibility of this information control.
 void widgetDisposed(DisposeEvent event)
          Sent when the widget is disposed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultInformationControl

public DefaultInformationControl(Shell parent,
                                 int shellStyle,
                                 int style,
                                 DefaultInformationControl.IInformationPresenter presenter)
Creates a default information control with the given shell as parent. The given information presenter is used to process the information to be displayed. The given styles are applied to the created styled text widget.

Parameters:
parent - the parent shell
shellStyle - the additional styles for the shell
style - the additional styles for the styled text widget
presenter - the presenter to be used

DefaultInformationControl

public DefaultInformationControl(Shell parent,
                                 int shellStyle,
                                 int style,
                                 DefaultInformationControl.IInformationPresenter presenter,
                                 String statusFieldText)
Creates a default information control with the given shell as parent. The given information presenter is used to process the information to be displayed. The given styles are applied to the created styled text widget.

Parameters:
parent - the parent shell
shellStyle - the additional styles for the shell
style - the additional styles for the styled text widget
presenter - the presenter to be used
statusFieldText - the text to be used in the optional status field or null if the status field should be hidden
Since:
3.0

DefaultInformationControl

public DefaultInformationControl(Shell parent,
                                 int style,
                                 DefaultInformationControl.IInformationPresenter presenter)
Creates a default information control with the given shell as parent. The given information presenter is used to process the information to be displayed. The given styles are applied to the created styled text widget.

Parameters:
parent - the parent shell
style - the additional styles for the styled text widget
presenter - the presenter to be used

DefaultInformationControl

public DefaultInformationControl(Shell parent,
                                 int style,
                                 DefaultInformationControl.IInformationPresenter presenter,
                                 String statusFieldText)
Creates a default information control with the given shell as parent. The given information presenter is used to process the information to be displayed. The given styles are applied to the created styled text widget.

Parameters:
parent - the parent shell
style - the additional styles for the styled text widget
presenter - the presenter to be used
statusFieldText - the text to be used in the optional status field or null if the status field should be hidden
Since:
3.0

DefaultInformationControl

public DefaultInformationControl(Shell parent)
Creates a default information control with the given shell as parent. No information presenter is used to process the information to be displayed. No additional styles are applied to the styled text widget.

Parameters:
parent - the parent shell

DefaultInformationControl

public DefaultInformationControl(Shell parent,
                                 DefaultInformationControl.IInformationPresenter presenter)
Creates a default information control with the given shell as parent. The given information presenter is used to process the information to be displayed. No additional styles are applied to the styled text widget.

Parameters:
parent - the parent shell
presenter - the presenter to be used
Method Detail

setInformation

public void setInformation(String content)
Description copied from interface: IInformationControl
Sets the information to be presented by this information control.

Replaced by IInformationControlExtension2.setInput(Object).

Specified by:
setInformation in interface IInformationControl
Parameters:
content - the information to be presented

setVisible

public void setVisible(boolean visible)
Description copied from interface: IInformationControl
Controls the visibility of this information control.

Specified by:
setVisible in interface IInformationControl
Parameters:
visible - true if the control should be visible

dispose

public void dispose()
Description copied from interface: IInformationControl
Disposes this information control.

Specified by:
dispose in interface IInformationControl

widgetDisposed

public void widgetDisposed(DisposeEvent event)
Description copied from interface: DisposeListener
Sent when the widget is disposed.

Specified by:
widgetDisposed in interface DisposeListener
Parameters:
event - an event containing information about the dispose

setSize

public void setSize(int width,
                    int height)
Description copied from interface: IInformationControl
Sets the size of this information control.

Specified by:
setSize in interface IInformationControl
Parameters:
width - the width of the control
height - the height of the control

setLocation

public void setLocation(Point location)
Description copied from interface: IInformationControl
Sets the location of this information control.

Specified by:
setLocation in interface IInformationControl
Parameters:
location - the location

setSizeConstraints

public void setSizeConstraints(int maxWidth,
                               int maxHeight)
Description copied from interface: IInformationControl
Sets the information control's size constraints. A constraint value of -1 indicates no constraint. This method must be called before computeSizeHint is called.

Note: An information control which implements IInformationControlExtension3 may ignore this method or use it as hint for its very first appearance.

Specified by:
setSizeConstraints in interface IInformationControl
Parameters:
maxWidth - the maximal width of the control to present the information, or -1 for not constraint
maxHeight - the maximal height of the control to present the information, or -1 for not constraint

computeSizeHint

public Point computeSizeHint()
Description copied from interface: IInformationControl
Computes and returns a proposal for the size of this information control depending on the information to present. The method tries to honor known size constraints but might return a size that exceeds them.

Specified by:
computeSizeHint in interface IInformationControl
Returns:
the computed size hint

computeTrim

public Rectangle computeTrim()
Description copied from interface: IInformationControlExtension3
Computes the trim for this control. x and y denote the upper left corner of the trimming relative to this control's location i.e. this will most likely be negative values. Width and height represent the border sizes.

Specified by:
computeTrim in interface IInformationControlExtension3
Returns:
the receivers trim

getBounds

public Rectangle getBounds()
Description copied from interface: IInformationControlExtension3
Returns a rectangle describing the receiver's size and location relative to its parent (or its display if its parent is null).

Note: If the receiver is already disposed then this methods must return the last valid location and size.

Specified by:
getBounds in interface IInformationControlExtension3
Returns:
the receiver's bounding rectangle

restoresLocation

public boolean restoresLocation()
Description copied from interface: IInformationControlExtension3
Tells whether this control allows to restore the previously used location.

Note: This is not a static property - it can change during the lifetime of this control.

Specified by:
restoresLocation in interface IInformationControlExtension3
Returns:
true if restoring location is supported

restoresSize

public boolean restoresSize()
Description copied from interface: IInformationControlExtension3
Tells whether this control allows to restore the previously used size.

Note: This is not a static property - it can change during the lifetime of this control.

Specified by:
restoresSize in interface IInformationControlExtension3
Returns:
true if restoring size is supported

addDisposeListener

public void addDisposeListener(DisposeListener listener)
Description copied from interface: IInformationControl
Adds the given listener to the list of dispose listeners. If the listener is already registered it is not registered again.

Specified by:
addDisposeListener in interface IInformationControl
Parameters:
listener - the listener to be added

removeDisposeListener

public void removeDisposeListener(DisposeListener listener)
Description copied from interface: IInformationControl
Removes the given listeners from the list of dispose listeners. If the listener is not registered this call has no effect.

Specified by:
removeDisposeListener in interface IInformationControl
Parameters:
listener - the listener to be removed

setForegroundColor

public void setForegroundColor(Color foreground)
Description copied from interface: IInformationControl
Sets the foreground color of this information control.

Specified by:
setForegroundColor in interface IInformationControl
Parameters:
foreground - the foreground color of this information control

setBackgroundColor

public void setBackgroundColor(Color background)
Description copied from interface: IInformationControl
Sets the background color of this information control.

Specified by:
setBackgroundColor in interface IInformationControl
Parameters:
background - the background color of this information control

isFocusControl

public boolean isFocusControl()
Description copied from interface: IInformationControl
Returns whether this information control has the focus.

Specified by:
isFocusControl in interface IInformationControl
Returns:
true when the information control has the focus otherwise false

setFocus

public void setFocus()
Description copied from interface: IInformationControl
Sets the keyboard focus to this information control.

Specified by:
setFocus in interface IInformationControl

addFocusListener

public void addFocusListener(FocusListener listener)
Description copied from interface: IInformationControl
Adds the given listener to the list of focus listeners. If the listener is already registered it is not registered again.

Specified by:
addFocusListener in interface IInformationControl
Parameters:
listener - the listener to be added

removeFocusListener

public void removeFocusListener(FocusListener listener)
Description copied from interface: IInformationControl
Removes the given listeners from the list of focus listeners. If the listener is not registered this call has no affect.

Specified by:
removeFocusListener in interface IInformationControl
Parameters:
listener - the listener to be removed

hasContents

public boolean hasContents()
Description copied from interface: IInformationControlExtension
Returns whether this information control has contents to be displayed.

Specified by:
hasContents in interface IInformationControlExtension
Returns:
true if there is contents to be displayed.

Eclipse Platform
Release 3.0

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.