public class DefaultInformationControl extends AbstractInformationControl implements DisposeListener
IInformationControl
.
Displays textual information in a StyledText
widget. Before displaying, the information set to this information control is
processed by an IInformationPresenter
.
Modifier and Type | Class and Description |
---|---|
static interface |
DefaultInformationControl.IInformationPresenter
An information presenter determines the style presentation
of information displayed in the default information control.
|
static interface |
DefaultInformationControl.IInformationPresenterExtension
An information presenter determines the style presentation
of information displayed in the default information control.
|
Constructor and Description |
---|
DefaultInformationControl(Shell parent)
Creates a default information control with the given shell as parent.
|
DefaultInformationControl(Shell parent,
boolean isResizeable)
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 textStyles,
DefaultInformationControl.IInformationPresenter presenter)
Deprecated.
As of 3.4, replaced by
DefaultInformationControl(Shell, DefaultInformationControl.IInformationPresenter) |
DefaultInformationControl(Shell parent,
int textStyles,
DefaultInformationControl.IInformationPresenter presenter,
String statusFieldText)
Deprecated.
As of 3.4, replaced by
DefaultInformationControl(Shell, String, DefaultInformationControl.IInformationPresenter) |
DefaultInformationControl(Shell parent,
int shellStyle,
int style,
DefaultInformationControl.IInformationPresenter presenter)
Deprecated.
As of 3.4, replaced by simpler constructors
|
DefaultInformationControl(Shell parentShell,
int shellStyle,
int style,
DefaultInformationControl.IInformationPresenter presenter,
String statusFieldText)
Deprecated.
As of 3.4, replaced by simpler constructors
|
DefaultInformationControl(Shell parent,
String statusFieldText)
Creates a default information control with the given shell as parent.
|
DefaultInformationControl(Shell parent,
String statusFieldText,
DefaultInformationControl.IInformationPresenter presenter)
Creates a default information control with the given shell as parent.
|
DefaultInformationControl(Shell parent,
ToolBarManager toolBarManager)
Creates a resizable default information control with the given shell as parent.
|
DefaultInformationControl(Shell parent,
ToolBarManager toolBarManager,
DefaultInformationControl.IInformationPresenter presenter)
Creates a resizable default information control with the given shell as
parent.
|
Modifier and Type | Method and Description |
---|---|
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 (status text and tool bar are considered as trim).
|
protected void |
createContent(Composite parent)
Creates the content of the popup window.
|
IInformationControlCreator |
getInformationPresenterControlCreator()
Returns the rich information control creator for this information control.
|
boolean |
hasContents()
Returns whether this information control has contents to be displayed.
|
void |
setBackgroundColor(Color background)
Sets the background color of 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 |
setVisible(boolean visible)
Controls the visibility of this information control.
|
void |
widgetDisposed(DisposeEvent event)
Deprecated.
As of 3.2, no longer used and called
|
addDisposeListener, addFocusListener, computeSizeConstraints, containsControl, create, dispose, getBounds, getShell, getSizeConstraints, getToolBarManager, handleDispose, isFocusControl, isResizable, isVisible, removeDisposeListener, removeFocusListener, restoresLocation, restoresSize, setFocus, setLocation, setSize, setSizeConstraints, setStatusText
public DefaultInformationControl(Shell parent, boolean isResizeable)
parent
- the parent shellisResizeable
- true
if the control should be resizablepublic DefaultInformationControl(Shell parent, String statusFieldText)
parent
- the parent shellstatusFieldText
- the text to be used in the status field or null
to hide the status fieldpublic DefaultInformationControl(Shell parent, String statusFieldText, DefaultInformationControl.IInformationPresenter presenter)
parent
- the parent shellstatusFieldText
- the text to be used in the status field or null
to hide the status fieldpresenter
- the presenter to be used, or null
if no presenter should be usedpublic DefaultInformationControl(Shell parent, ToolBarManager toolBarManager)
parent
- the parent shelltoolBarManager
- the manager or null
if toolbar is not desiredpublic DefaultInformationControl(Shell parent, ToolBarManager toolBarManager, DefaultInformationControl.IInformationPresenter presenter)
parent
- the parent shelltoolBarManager
- the manager or null
if toolbar is not desiredpresenter
- the presenter to be used, or null
if no presenter should be usedpublic DefaultInformationControl(Shell parent)
parent
- the parent shellpublic DefaultInformationControl(Shell parent, DefaultInformationControl.IInformationPresenter presenter)
parent
- the parent shellpresenter
- the presenter to be usedpublic DefaultInformationControl(Shell parent, int shellStyle, int style, DefaultInformationControl.IInformationPresenter presenter)
parent
- the parent shellshellStyle
- the additional styles for the shellstyle
- the additional styles for the styled text widgetpresenter
- the presenter to be usedpublic DefaultInformationControl(Shell parentShell, int shellStyle, int style, DefaultInformationControl.IInformationPresenter presenter, String statusFieldText)
parentShell
- the parent shellshellStyle
- the additional styles for the shellstyle
- the additional styles for the styled text widgetpresenter
- the presenter to be usedstatusFieldText
- the text to be used in the status field or null
to hide the status fieldpublic DefaultInformationControl(Shell parent, int textStyles, DefaultInformationControl.IInformationPresenter presenter)
DefaultInformationControl(Shell, DefaultInformationControl.IInformationPresenter)
parent
- the parent shelltextStyles
- the additional styles for the styled text widgetpresenter
- the presenter to be usedpublic DefaultInformationControl(Shell parent, int textStyles, DefaultInformationControl.IInformationPresenter presenter, String statusFieldText)
DefaultInformationControl(Shell, String, DefaultInformationControl.IInformationPresenter)
parent
- the parent shelltextStyles
- the additional styles for the styled text widgetpresenter
- the presenter to be usedstatusFieldText
- the text to be used in the status field or null
to hide the status fieldprotected void createContent(Composite parent)
AbstractInformationControl
Implementors will usually take over Control.getBackground()
and
Control.getForeground()
from parent
.
Implementors must either use the dialog font or override
AbstractInformationControl.computeSizeConstraints(int, int)
.
Implementors are expected to consider AbstractInformationControl.isResizable()
: If true
, they
should show scrollbars if their content may exceed the size of the information control. If
false
, they should never show scrollbars.
The given parent
comes with a FillLayout
. Subclasses may set a different
layout.
createContent
in class AbstractInformationControl
parent
- the container of the contentpublic void setInformation(String content)
AbstractInformationControl
The default implementation does nothing. Subclasses must either override this method
or implement IInformationControlExtension2
.
setInformation
in interface IInformationControl
setInformation
in class AbstractInformationControl
content
- the information to be presentedIInformationControl.setInformation(java.lang.String)
public void setVisible(boolean visible)
IInformationControl
Note: The information control must not grab focus when made visible.
setVisible
in interface IInformationControl
setVisible
in class AbstractInformationControl
visible
- true
if the control should be visiblepublic Point computeSizeHint()
IInformationControl
computeSizeHint
in interface IInformationControl
computeSizeHint
in class AbstractInformationControl
public Rectangle computeTrim()
AbstractInformationControl
computeTrim
in interface IInformationControlExtension3
computeTrim
in class AbstractInformationControl
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 (the sum of the horizontal and vertical trimmings,
respectively).IInformationControlExtension3.computeTrim()
public void setForegroundColor(Color foreground)
IInformationControl
setForegroundColor
in interface IInformationControl
setForegroundColor
in class AbstractInformationControl
foreground
- the foreground color of this information controlpublic void setBackgroundColor(Color background)
IInformationControl
setBackgroundColor
in interface IInformationControl
setBackgroundColor
in class AbstractInformationControl
background
- the background color of this information controlpublic boolean hasContents()
IInformationControlExtension
hasContents
in interface IInformationControlExtension
true
if there is contents to be displayed.public void widgetDisposed(DisposeEvent event)
DisposeListener
widgetDisposed
in interface DisposeListener
event
- an event containing information about the disposeDisposeListener.widgetDisposed(org.eclipse.swt.events.DisposeEvent)
public IInformationControlCreator getInformationPresenterControlCreator()
AbstractInformationControl
The returned information control creator is used to create an enriched version of this
information control, e.g. when the mouse is moved into this control and it needs to be
enriched
or when it needs to be made sticky for other reasons.
The returned information control creator must create information controls
that implement IInformationControlExtension3
and IInformationControlExtension2
,
and whose IInformationControlExtension2.setInput(Object)
accepts all inputs that are
also supported by this information control.
Note that automatic enriching of this information control works only if it also implements
IInformationControlExtension3
.
This method may be called frequently, so implementors should ensure it returns quickly, e.g. by caching the returned creator.
This default implementation returnsnull
. Subclasses may override.getInformationPresenterControlCreator
in interface IInformationControlExtension5
getInformationPresenterControlCreator
in class AbstractInformationControl
null
to disable enriching
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.