public class AdapterFactoryLabelProvider extends java.lang.Object implements INotifyChangedListener
ILabelProvider
is delegated to IItemLabelProvider
;
IFontProvider
is delegated to IItemFontProvider
;
IColorProvider
is delegated to IItemColorProvider
;
ITableLabelProvider
is delegated to ITableItemLabelProvider
;
and ITableFontProvider
is delegated to ITableItemFontProvider
.
and ITableColorProvider
is delegated to ITableItemColorProvider
.
The label provider has no mechanism for notifying the viewer of changes. As long as the AdapterFactory is also used in an AdapterFactoryContentProvider, this won't be a problem, because notifications will be forward as a result of that.
Modifier and Type | Class and Description |
---|---|
static class |
AdapterFactoryLabelProvider.ColorProvider
An extended version of the adapter factory label provider that also provides for colors.
|
protected class |
AdapterFactoryLabelProvider.ConvertingStyler
|
static class |
AdapterFactoryLabelProvider.FontAndColorProvider
An extended version of the adapter factory label provider that also provides for fonts and colors.
|
static class |
AdapterFactoryLabelProvider.FontProvider
An extended version of the adapter factory label provider that also provides for fonts.
|
static class |
AdapterFactoryLabelProvider.StyledLabelProvider
An extended version of the adapter factory label provider that also provides for styled string.
|
Modifier and Type | Field and Description |
---|---|
protected AdapterFactory |
adapterFactory
This keep track of the one factory we are using.
|
protected Color |
defaultBackground
The background color that will be used when no background color is specified.
|
protected Font |
defaultFont
The font that will be used when no font is specified.
|
protected Color |
defaultForeground
The foreground color that will be used when no foreground color is specified.
|
protected boolean |
isFireLabelUpdateNotifications
Whether label update notifications are fired.
|
protected java.util.Collection<ILabelProviderListener> |
labelProviderListeners
This keeps track of the label provider listeners.
|
Constructor and Description |
---|
AdapterFactoryLabelProvider(AdapterFactory adapterFactory)
Construct an instance that wraps the given factory.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(ILabelProviderListener listener)
Since we won't ever generate these notifications, we can just ignore this.
|
protected Styler |
createStyler(StyledString.Style style)
Returns a new styler with the same styling information as the given style.
|
void |
dispose()
This discards the content provider and removes this as a listener to the
adapterFactory . |
void |
fireLabelProviderChanged() |
AdapterFactory |
getAdapterFactory()
Return the wrapped AdapterFactory.
|
Color |
getBackground(java.lang.Object object)
This implements
org.eclipse.jface.viewers.IColorProvider .getBackground by forwarding it to an object that implements
IItemColorProvider.getBackground |
Color |
getBackground(java.lang.Object object,
int columnIndex)
This implements
ITableColorProvider .getBackground by forwarding it to an object that implements
ITableItemColorProvider.getBackground
or failing that, an object that implements
IItemColorProvider.getBackground
where the columnIndex is ignored. |
protected Color |
getColorFromObject(java.lang.Object object) |
Image |
getColumnImage(java.lang.Object object,
int columnIndex)
This implements
ITableLabelProvider .getColumnImage by forwarding it to an object that implements
ITableItemLabelProvider.getColumnImage
or failing that, an object that implements
IItemLabelProvider.getImage
where the columnIndex is ignored. |
java.lang.String |
getColumnText(java.lang.Object object,
int columnIndex)
This implements
ITableLabelProvider .getColumnText by forwarding it to an object that implements
ITableItemLabelProvider.getColumnText
or failing that, an object that implements
IItemLabelProvider.getText
where the columnIndex are is ignored. |
Color |
getDefaultBackground()
Return the default background color.
|
Font |
getDefaultFont()
Return the default font.
|
Color |
getDefaultForeground()
Return the default foreground color.
|
protected Image |
getDefaultImage(java.lang.Object object) |
Font |
getFont(java.lang.Object object)
This implements
org.eclipse.jface.viewers.IFontProvider .getFont by forwarding it to an object that implements
IItemFontProvider.getFont |
Font |
getFont(java.lang.Object object,
int columnIndex)
This implements
ITableFontProvider .getFont by forwarding it to an object that implements
ITableItemFontProvider.getFont
or failing that, an object that implements
IItemFontProvider.getFont
where the columnIndex is ignored. |
protected Font |
getFontFromObject(java.lang.Object object) |
Color |
getForeground(java.lang.Object object)
This implements
org.eclipse.jface.viewers.IColorProvider .getForeground by forwarding it to an object that implements
IItemColorProvider.getForeground |
Color |
getForeground(java.lang.Object object,
int columnIndex)
This implements
ITableColorProvider .getForeground by forwarding it to an object that implements
ITableItemColorProvider.getForeground
or failing that, an object that implements
IItemColorProvider.getForeground
where the columnIndex is ignored. |
Image |
getImage(java.lang.Object object)
This implements
org.eclipse.jface.viewers.ILabelProvider .getImage by forwarding it to an object that implements
IItemLabelProvider.getImage |
protected Image |
getImageFromObject(java.lang.Object object) |
protected StyledString |
getStyledStringFromObject(java.lang.Object object) |
StyledString |
getStyledText(java.lang.Object object)
This implements
org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider .getStyledText by forwarding it to an object that implements
IItemStyledLabelProvider.getStyledText |
java.lang.String |
getText(java.lang.Object object)
This implements
ILabelProvider .getText by forwarding it to an object that implements
IItemLabelProvider.getText |
boolean |
isFireLabelUpdateNotifications()
Returns whether this label provider fires
update notifications . |
boolean |
isLabelProperty(java.lang.Object object,
java.lang.String id)
This always returns true right now.
|
void |
notifyChanged(Notification notification) |
void |
removeListener(ILabelProviderListener listener)
Since we won't ever add listeners, we can just ignore this.
|
void |
setAdapterFactory(AdapterFactory adapterFactory)
Set the wrapped AdapterFactory.
|
void |
setDefaultBackground(Color color)
Set the default background color.
|
void |
setDefaultFont(Font font)
Set the default font.
|
void |
setDefaultForeground(Color color)
Set the default foreground color.
|
void |
setFireLabelUpdateNotifications(boolean isFireLabelUpdateNotifications)
Sets whether this label provider fires
update notifications . |
protected StyledString |
toJFaceStyledString(StyledString styledString) |
protected AdapterFactory adapterFactory
ComposedAdapterFactory
if adapters from more the one factory are involved in the model.protected Font defaultFont
protected Color defaultForeground
protected Color defaultBackground
protected java.util.Collection<ILabelProviderListener> labelProviderListeners
protected boolean isFireLabelUpdateNotifications
public AdapterFactoryLabelProvider(AdapterFactory adapterFactory)
IChangeNotifier
,
a listener is added to it,
so it's important to call dispose()
.adapterFactory
- an adapter factory that yield adapters that implement the various item label provider interfaces.public AdapterFactory getAdapterFactory()
public void setAdapterFactory(AdapterFactory adapterFactory)
IChangeNotifier
,
a listener is added to it,
so it's important to call dispose()
.public Font getDefaultFont()
public void setDefaultFont(Font font)
public Color getDefaultForeground()
public void setDefaultForeground(Color color)
public Color getDefaultBackground()
public void setDefaultBackground(Color color)
public void addListener(ILabelProviderListener listener)
public void removeListener(ILabelProviderListener listener)
public void dispose()
adapterFactory
.public boolean isLabelProperty(java.lang.Object object, java.lang.String id)
public Image getImage(java.lang.Object object)
org.eclipse.jface.viewers.ILabelProvider
.getImage by forwarding it to an object that implements
IItemLabelProvider.getImage
protected Image getDefaultImage(java.lang.Object object)
protected Image getImageFromObject(java.lang.Object object)
public java.lang.String getText(java.lang.Object object)
ILabelProvider
.getText by forwarding it to an object that implements
IItemLabelProvider.getText
public Font getFont(java.lang.Object object)
org.eclipse.jface.viewers.IFontProvider
.getFont by forwarding it to an object that implements
IItemFontProvider.getFont
protected Font getFontFromObject(java.lang.Object object)
public StyledString getStyledText(java.lang.Object object)
org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider
.getStyledText by forwarding it to an object that implements
IItemStyledLabelProvider.getStyledText
protected StyledString getStyledStringFromObject(java.lang.Object object)
protected StyledString toJFaceStyledString(StyledString styledString)
protected Styler createStyler(StyledString.Style style)
public Color getForeground(java.lang.Object object)
org.eclipse.jface.viewers.IColorProvider
.getForeground by forwarding it to an object that implements
IItemColorProvider.getForeground
public Color getBackground(java.lang.Object object)
org.eclipse.jface.viewers.IColorProvider
.getBackground by forwarding it to an object that implements
IItemColorProvider.getBackground
protected Color getColorFromObject(java.lang.Object object)
public Image getColumnImage(java.lang.Object object, int columnIndex)
ITableLabelProvider
.getColumnImage by forwarding it to an object that implements
ITableItemLabelProvider.getColumnImage
or failing that, an object that implements
IItemLabelProvider.getImage
where the columnIndex is ignored.public java.lang.String getColumnText(java.lang.Object object, int columnIndex)
ITableLabelProvider
.getColumnText by forwarding it to an object that implements
ITableItemLabelProvider.getColumnText
or failing that, an object that implements
IItemLabelProvider.getText
where the columnIndex are is ignored.public Font getFont(java.lang.Object object, int columnIndex)
ITableFontProvider
.getFont by forwarding it to an object that implements
ITableItemFontProvider.getFont
or failing that, an object that implements
IItemFontProvider.getFont
where the columnIndex is ignored.public Color getForeground(java.lang.Object object, int columnIndex)
ITableColorProvider
.getForeground by forwarding it to an object that implements
ITableItemColorProvider.getForeground
or failing that, an object that implements
IItemColorProvider.getForeground
where the columnIndex is ignored.public Color getBackground(java.lang.Object object, int columnIndex)
ITableColorProvider
.getBackground by forwarding it to an object that implements
ITableItemColorProvider.getBackground
or failing that, an object that implements
IItemColorProvider.getBackground
where the columnIndex is ignored.public boolean isFireLabelUpdateNotifications()
update notifications
.public void setFireLabelUpdateNotifications(boolean isFireLabelUpdateNotifications)
update notifications
.public void fireLabelProviderChanged()
public void notifyChanged(Notification notification)
notifyChanged
in interface INotifyChangedListener