public abstract class AbstractInformationControlManager extends Object
IInformationControl
. This manager can be
installed on and removed from a control, referred to as the subject control,
i.e. the one from which the subject of the information to be shown is
retrieved. Also a manager can be enabled or disabled. An installed and
enabled manager can be forced to show information in its information control
using showInformation
. An information control manager uses an
IInformationControlCloser
to define the behavior when a
presented information control must be closed. The disposal of the subject and
the information control are internally handled by the information control
manager and are not the responsibility of the information control closer.IInformationControl
Modifier and Type | Class and Description |
---|---|
static class |
AbstractInformationControlManager.Anchor
Constitutes entities to enumerate anchors for the layout of the information control.
|
static interface |
AbstractInformationControlManager.IInformationControlCloser
Interface of an information control closer.
|
Modifier and Type | Field and Description |
---|---|
static AbstractInformationControlManager.Anchor |
ANCHOR_BOTTOM
Anchor representing the bottom of the information area
|
static AbstractInformationControlManager.Anchor |
ANCHOR_GLOBAL
Anchor representing the middle of the subject control
|
static AbstractInformationControlManager.Anchor |
ANCHOR_LEFT
Anchor representing the left side of the information area
|
static AbstractInformationControlManager.Anchor |
ANCHOR_RIGHT
Anchor representing the right side of the information area
|
static AbstractInformationControlManager.Anchor |
ANCHOR_TOP
Anchor representing the top of the information area
|
protected static boolean |
DEBUG
Tells whether this class and its subclasses are in debug mode.
|
protected boolean |
fDisposed
Indicates that the information control has been disposed.
|
protected IInformationControl |
fInformationControl
The information control.
|
protected AbstractInformationControlManager.IInformationControlCloser |
fInformationControlCloser
The information control closer.
|
protected IInformationControlCreator |
fInformationControlCreator
The information control creator.
|
static String |
STORE_LOCATION_X
Dialog store constant for the location's x-coordinate.
|
static String |
STORE_LOCATION_Y
Dialog store constant for the location's y-coordinate.
|
static String |
STORE_SIZE_HEIGHT
Dialog store constant for the size's height.
|
static String |
STORE_SIZE_WIDTH
Dialog store constant for the size's width.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractInformationControlManager(IInformationControlCreator creator)
Creates a new information control manager using the given information control creator.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
canClearDataOnHide()
Tells whether internal data can be cleared on hide.
|
protected Rectangle |
computeAvailableArea(Rectangle subjectArea,
Rectangle bounds,
AbstractInformationControlManager.Anchor anchor)
Computes the area available for an information control given an anchor and the subject area
within
bounds . |
protected abstract void |
computeInformation()
Computes the information to be displayed and the area in which the computed
information is valid.
|
protected Point |
computeInformationControlLocation(Rectangle subjectArea,
Point controlSize)
Computes the location of the information control depending on the
subject area and the size of the information control.
|
protected Point |
computeLocation(Rectangle subjectArea,
Point controlSize,
AbstractInformationControlManager.Anchor anchor)
Computes the display location of the information control.
|
protected Point |
computeSizeConstraints(Control subjectControl,
IInformationControl informationControl)
Computes the size constraints of the information control in points based on the
default font of the given subject control as well as the size constraints in character
width.
|
protected Point |
computeSizeConstraints(Control subjectControl,
Rectangle subjectArea,
IInformationControl informationControl)
Computes the size constraints of the information control in points.
|
void |
dispose()
Disposes this manager and if necessary all dependent parts such as
the information control.
|
void |
disposeInformationControl()
Disposes this manager's information control.
|
protected void |
doShowInformation()
Computes information to be displayed as well as the subject area
and initiates that this information is presented in the information control.
|
protected IInformationControl |
getInformationControl()
Returns the information control.
|
org.eclipse.jface.internal.text.InternalAccessor |
getInternalAccessor()
Returns an adapter that gives access to internal methods.
|
protected AbstractInformationControlManager.Anchor |
getNextFallbackAnchor(AbstractInformationControlManager.Anchor anchor)
Returns the next fallback anchor as specified by this manager's
fallback anchor sequence.
|
protected Rectangle |
getSubjectArea()
Returns the actual subject area.
|
protected Control |
getSubjectControl()
Returns the subject control of this manager/information control.
|
protected void |
handleInformationControlDisposed()
Handles the disposal of the information control.
|
protected void |
handleSubjectControlDisposed()
Handles the disposal of the subject control.
|
protected void |
hideInformationControl()
Hides the information control and stops the information control closer.
|
void |
install(Control subjectControl)
Installs this manager on the given control.
|
protected boolean |
isEnabled()
Returns whether this manager is enabled or not.
|
protected boolean |
isTakingFocusWhenVisible()
Tells whether the control takes focus when visible.
|
protected void |
presentInformation()
Presents the information in the information control or hides the information
control if no information should be presented.
|
protected Rectangle |
restoreInformationControlBounds()
Restores the information control's bounds.
|
void |
setAnchor(AbstractInformationControlManager.Anchor anchor)
Sets the anchor used for laying out the information control relative to the
subject control.
|
protected void |
setCloser(AbstractInformationControlManager.IInformationControlCloser closer)
Sets the information control closer for this manager.
|
protected void |
setCustomInformationControlCreator(IInformationControlCreator informationControlCreator)
Sets the temporary custom control creator, overriding this manager's default information control creator.
|
void |
setEnabled(boolean enabled)
Deprecated.
visibility will be changed to protected
|
void |
setFallbackAnchors(AbstractInformationControlManager.Anchor[] fallbackAnchors)
Sets the anchors fallback sequence used to layout the information control if the original
anchor can not be used because the information control would not fit in the display client
area.
|
protected void |
setInformation(Object information,
Rectangle subjectArea)
Sets the parameters of the information to be displayed.
|
protected void |
setInformation(String information,
Rectangle subjectArea)
Sets the parameters of the information to be displayed.
|
void |
setMargins(int xMargin,
int yMargin)
Sets the horizontal and vertical margin to be used when laying out the
information control relative to the subject control.
|
void |
setRestoreInformationControlBounds(IDialogSettings dialogSettings,
boolean restoreLocation,
boolean restoreSize)
Tells this information control manager to open the information control with the values
contained in the given dialog settings and to store the control's last valid size in the
given dialog settings.
|
void |
setSizeConstraints(int widthInChar,
int heightInChar,
boolean enforceAsMinimalSize,
boolean enforceAsMaximalSize)
Sets the width- and height constraints of the information control.
|
void |
showInformation()
Computes information to be displayed as well as the subject area
and initiates that this information is presented in the information control.
|
protected void |
showInformationControl(Rectangle subjectArea)
Shows the information control and starts the information control closer.
|
protected void |
storeInformationControlBounds()
Stores the information control's bounds.
|
void |
takesFocusWhenVisible(boolean takesFocus)
Tells the manager whether it should set the focus to the information control when made visible.
|
protected boolean |
updateLocation(Point location,
Point size,
Rectangle displayArea,
AbstractInformationControlManager.Anchor anchor)
Checks whether a control of the given size at the given location would be completely visible
in the given display area when laid out by using the given anchor.
|
public static final AbstractInformationControlManager.Anchor ANCHOR_TOP
public static final AbstractInformationControlManager.Anchor ANCHOR_BOTTOM
public static final AbstractInformationControlManager.Anchor ANCHOR_LEFT
public static final AbstractInformationControlManager.Anchor ANCHOR_RIGHT
public static final AbstractInformationControlManager.Anchor ANCHOR_GLOBAL
public static final String STORE_LOCATION_X
public static final String STORE_LOCATION_Y
public static final String STORE_SIZE_WIDTH
public static final String STORE_SIZE_HEIGHT
protected static final boolean DEBUG
Subclasses may use this.
protected IInformationControl fInformationControl
This field should not be referenced by subclasses. It is protected
for API
compatibility reasons.
protected IInformationControlCreator fInformationControlCreator
This field should not be referenced by subclasses. It is protected
for API
compatibility reasons.
protected AbstractInformationControlManager.IInformationControlCloser fInformationControlCloser
This field should not be referenced by subclasses. It is protected
for API
compatibility reasons.
protected boolean fDisposed
This field should not be referenced by subclasses. It is protected
for API
compatibility reasons.
protected AbstractInformationControlManager(IInformationControlCreator creator)
creator
- the information control creatorprotected abstract void computeInformation()
setInformation
.protected final void setInformation(String information, Rectangle subjectArea)
presentInformation()
to trigger the presentation of the computed information.information
- the information, or null
if none is availablesubjectArea
- the subject area, or null
if none is availableprotected final void setInformation(Object information, Rectangle subjectArea)
presentInformation()
to trigger the presentation of the computed information.information
- the information, or null
if none is availablesubjectArea
- the subject area, or null
if none is availableprotected void setCloser(AbstractInformationControlManager.IInformationControlCloser closer)
closer
- the information control closer for this managerpublic void setMargins(int xMargin, int yMargin)
xMargin
- the x-marginyMargin
- the y-Marginpublic void setSizeConstraints(int widthInChar, int heightInChar, boolean enforceAsMinimalSize, boolean enforceAsMaximalSize)
widthInChar
- the width constraint in number of charactersheightInChar
- the height constrain in number of charactersenforceAsMinimalSize
- indicates whether the constraints describe the minimal allowed size of the controlenforceAsMaximalSize
- indicates whether the constraints describe the maximal allowed size of the controlpublic void setRestoreInformationControlBounds(IDialogSettings dialogSettings, boolean restoreLocation, boolean restoreSize)
Note: This API is only valid if the information control implements
IInformationControlExtension3
. Not following this restriction will later result in an
UnsupportedOperationException
.
The constants used to store the values are:
dialogSettings
- the dialog settingsrestoreLocation
- true
iff the location is must be (re-)storedrestoreSize
- true
iff the size is (re-)storedpublic void setAnchor(AbstractInformationControlManager.Anchor anchor)
ANCHOR_TOP
indicates that the
information control is position above the area for which the information to
be displayed is valid.anchor
- the layout anchorpublic void setFallbackAnchors(AbstractInformationControlManager.Anchor[] fallbackAnchors)
The fallback anchor for a given anchor is the one that comes directly after the given anchor or is the first one in the sequence if the given anchor is the last one in the sequence.
Note: This sequence is ignored if the original anchor is not contained in this list.
fallbackAnchors
- the array with the anchor fallback sequencesetAnchor(AbstractInformationControlManager.Anchor)
protected void setCustomInformationControlCreator(IInformationControlCreator informationControlCreator)
informationControlCreator
- the creator, possibly null
public void takesFocusWhenVisible(boolean takesFocus)
takesFocus
- true
if information control should take focus when made visibleprotected boolean isTakingFocusWhenVisible()
true
if the control takes focus when visible, false
otherwiseprotected void handleSubjectControlDisposed()
disposeInformationControl
. Subclasses may extend
this method.public void install(Control subjectControl)
subjectControl
- the subject controlprotected Control getSubjectControl()
protected Rectangle getSubjectArea()
public void setEnabled(boolean enabled)
enabled
- the enable stateprotected boolean isEnabled()
true
if this manager is enabled otherwise false
protected Point computeSizeConstraints(Control subjectControl, IInformationControl informationControl)
subjectControl
- the subject controlinformationControl
- the information control whose size constraints are computedprotected Point computeSizeConstraints(Control subjectControl, Rectangle subjectArea, IInformationControl informationControl)
subjectControl
- the subject controlsubjectArea
- the subject areainformationControl
- the information control whose size constraints are computedprotected void handleInformationControlDisposed()
protected IInformationControl getInformationControl()
protected Point computeLocation(Rectangle subjectArea, Point controlSize, AbstractInformationControlManager.Anchor anchor)
subjectArea
- the subject areacontrolSize
- the size of the information controlanchor
- the anchor at the subject areaprotected Rectangle computeAvailableArea(Rectangle subjectArea, Rectangle bounds, AbstractInformationControlManager.Anchor anchor)
bounds
.subjectArea
- the subject areabounds
- the boundsanchor
- the anchor at the subject areaprotected boolean updateLocation(Point location, Point size, Rectangle displayArea, AbstractInformationControlManager.Anchor anchor)
This method returns true
if the potentially updated position results in a
completely visible control, or false
otherwise.
location
- the location of the controlsize
- the size of the controldisplayArea
- the display area in which the control should be visibleanchor
- anchor for lying out the controltrue
if the updated location is usefulprotected AbstractInformationControlManager.Anchor getNextFallbackAnchor(AbstractInformationControlManager.Anchor anchor)
The fallback anchor for the given anchor is the one that comes directly after the given anchor or is the first one in the sequence if the given anchor is the last one in the sequence.
Note: It is the callers responsibility to prevent an endless loop i.e. to test whether a given anchor has already been used once. then
anchor
- the current anchornull
if no fallback anchor is availableprotected Point computeInformationControlLocation(Rectangle subjectArea, Point controlSize)
subjectArea
- the information areacontrolSize
- the size of the information controlpublic void showInformation()
protected void doShowInformation()
protected void presentInformation()
setInformation
.
This method should only be called from overriding methods or from setInformation
.
protected void hideInformationControl()
protected boolean canClearDataOnHide()
true
if data can be cleared on hidehideInformationControl()
protected void showInformationControl(Rectangle subjectArea)
subjectArea
- the information areapublic void disposeInformationControl()
public void dispose()
protected void storeInformationControlBounds()
protected Rectangle restoreInformationControlBounds()
public org.eclipse.jface.internal.text.InternalAccessor getInternalAccessor()
Note: This method is not intended to be referenced or overridden by clients.
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.