Package com.iizigo.text
Class TextTableLabelProvider
- java.lang.Object
- org.eclipse.core.commands.common.EventManager
- org.eclipse.jface.viewers.BaseLabelProvider
- org.eclipse.jface.viewers.CellLabelProvider
- org.eclipse.jface.viewers.OwnerDrawLabelProvider
- org.eclipse.jface.viewers.StyledCellLabelProvider
- com.iizigo.text.TextTableLabelProvider
- All Implemented Interfaces:
EventListener,org.eclipse.jface.viewers.IBaseLabelProvider,org.eclipse.jface.viewers.IToolTipProvider
public class TextTableLabelProvider extends org.eclipse.jface.viewers.StyledCellLabelProvider implements EventListener
Label provider for a string map property for a column table with several text table and filters.- Author:
- Christopher Mindus
Constructor Summary
Constructors Constructor Description TextTableLabelProvider(java.util.ArrayList<IzFilter> filters)The TextTableLabelProvider being used for the TooltipTableViewer.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Handles dispose.org.eclipse.swt.graphics.ColorgetBackground(java.lang.Object element, int columnIndex)Provides a background color for the given element at the specified indexorg.eclipse.swt.graphics.ImagegetColumnImage(java.lang.Object element, int columnIndex)Returns the label image for the given column of the given element.java.lang.StringgetColumnText(java.lang.Object element, int columnIndex)Returns the label text for the given column of the given element.KStringPropgetColumnTextProp(KStringProp ksp, int columnIndex)Returns the label text for the given column of the given element.KStringPropgetColumnTextProp(java.lang.Object element, int columnIndex)Returns the label text for the given column of the given element.intgetErrorLevel(java.lang.Object element, int columnIndex)Get the error level for an element at column.org.eclipse.swt.graphics.FontgetFont(java.lang.Object element, int columnIndex)Provides a font for the given element at index columnIndex.org.eclipse.swt.graphics.ColorgetForeground(java.lang.Object element, int columnIndex)Provides a foreground color for the given element.static org.eclipse.swt.graphics.ImagegetImage(KStringProp kstringProp)Gets the image of a KStringProp.static org.eclipse.swt.graphics.ImagegetImage(KString kstring)Gets the image of a KString.org.eclipse.swt.graphics.ImagegetImage(java.lang.Object element)Returns the image for the label of the given element.java.lang.StringgetText(java.lang.Object element)Returns the text for the label of the given element.voidonEvent(GEvent event)Called to process an event.voidset2ColumnTreeTable()Sets the 2-column tree-table mode.voidsetInput(java.util.ArrayList<EditorTextTable> textTables)Sets the input.voidsetItalicFont(org.eclipse.swt.graphics.Font undefined)Sets the font to use for text ID's that are defined in other text tables but is not present in the main edited text table.voidupdate(org.eclipse.jface.viewers.ViewerCell cell)Updates the cell contents.Methods inherited from class org.eclipse.jface.viewers.StyledCellLabelProvider
erase, getColumn, getViewer, initialize, isOwnerDrawEnabled, measure, paint, prepareStyleRange, setOwnerDrawEnabled, styleDecoratedString
Methods inherited from class org.eclipse.jface.viewers.OwnerDrawLabelProvider
dispose, initialize, setOwnerDrawEnabled, setUpOwnerDraw
Methods inherited from class org.eclipse.jface.viewers.CellLabelProvider
getToolTipBackgroundColor, getToolTipDisplayDelayTime, getToolTipFont, getToolTipForegroundColor, getToolTipImage, getToolTipShift, getToolTipStyle, getToolTipText, getToolTipTimeDisplayed, useNativeToolTip
Methods inherited from class org.eclipse.jface.viewers.BaseLabelProvider
addListener, fireLabelProviderChanged, isLabelProperty, removeListener
Constructor Detail
TextTableLabelProvider
public TextTableLabelProvider(java.util.ArrayList<IzFilter> filters)
The TextTableLabelProvider being used for the TooltipTableViewer.
Method Detail
getImage
public static org.eclipse.swt.graphics.Image getImage(KString kstring)
Gets the image of a KString.- Parameters:
kstring- The KString, or null for none.- Returns:
- The image, or null for none.
getImage
public static org.eclipse.swt.graphics.Image getImage(KStringProp kstringProp)
Gets the image of a KStringProp.- Parameters:
kstringProp- The KStringProp, or null for none.- Returns:
- The image, or null for none.
set2ColumnTreeTable
public void set2ColumnTreeTable()
Sets the 2-column tree-table mode.
onEvent
public void onEvent(GEvent event)
Called to process an event.- Specified by:
onEventin interfaceEventListener- Parameters:
event- The event.
update
public void update(org.eclipse.jface.viewers.ViewerCell cell)
Updates the cell contents.- Overrides:
updatein classorg.eclipse.jface.viewers.StyledCellLabelProvider
setInput
public void setInput(java.util.ArrayList<EditorTextTable> textTables)
Sets the input. This is required to be called when multiple text tables are edited, not when just one is used.- Parameters:
textTables- The text tables.
dispose
public void dispose()
Handles dispose.- Specified by:
disposein interfaceorg.eclipse.jface.viewers.IBaseLabelProvider- Overrides:
disposein classorg.eclipse.jface.viewers.StyledCellLabelProvider
setItalicFont
public void setItalicFont(org.eclipse.swt.graphics.Font undefined)
Sets the font to use for text ID's that are defined in other text tables but is not present in the main edited text table.
getColumnImage
public org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object element, int columnIndex)Returns the label image for the given column of the given element.- Parameters:
element- the object representing the entire row, ornullindicating that no input object is set in the viewercolumnIndex- the zero-based index of the column in which the label appears- Returns:
- Image or
nullif there is no image for the given object at columnIndex
getColumnText
public java.lang.String getColumnText(java.lang.Object element, int columnIndex)Returns the label text for the given column of the given element.- Parameters:
element- the object representing the entire row, ornullindicating that no input object is set in the viewercolumnIndex- the zero-based index of the column in which the label appears- Returns:
- String or
nullif there is no text for the given object at columnIndex
getColumnTextProp
public KStringProp getColumnTextProp(java.lang.Object element, int columnIndex)
Returns the label text for the given column of the given element.- Parameters:
element- the object representing the entire row, ornullindicating that no input object is set in the viewercolumnIndex- the zero-based index of the column in which the label appears- Returns:
- String, KStringProp or
nullif there is no text for the given object at columnIndex.
getColumnTextProp
public KStringProp getColumnTextProp(KStringProp ksp, int columnIndex)
Returns the label text for the given column of the given element.- Parameters:
ksp- The element property.columnIndex- The zero-based index of the column in which the label appears- Returns:
- String, KStringProp or
nullif there is no text for the given object at columnIndex.
getImage
public org.eclipse.swt.graphics.Image getImage(java.lang.Object element)
Returns the image for the label of the given element. The image is owned by the label provider and must not be disposed directly. Instead, dispose the label provider when no longer needed.- Parameters:
element- the element for which to provide the label image- Returns:
- the image used to label the element, or
nullif there is no image for the given object
getText
public java.lang.String getText(java.lang.Object element)
Returns the text for the label of the given element.- Parameters:
element- the element for which to provide the label text- Returns:
- the text string used to label the element, or
nullif there is no text label for the given object
getForeground
public org.eclipse.swt.graphics.Color getForeground(java.lang.Object element, int columnIndex)Provides a foreground color for the given element.- Parameters:
element- the elementcolumnIndex- the zero-based index of the column in which the color appears- Returns:
- the foreground color for the element, or
nullto use the default foreground color
getBackground
public org.eclipse.swt.graphics.Color getBackground(java.lang.Object element, int columnIndex)Provides a background color for the given element at the specified index- Parameters:
element- the elementcolumnIndex- the zero-based index of the column in which the color appears- Returns:
- the background color for the element, or
nullto use the default background color
getFont
public org.eclipse.swt.graphics.Font getFont(java.lang.Object element, int columnIndex)Provides a font for the given element at index columnIndex.- Parameters:
element- The element being displayed.columnIndex- The index of the column being displayed.- Returns:
- Font to use, or null for none.
getErrorLevel
public int getErrorLevel(java.lang.Object element, int columnIndex)Get the error level for an element at column.- Parameters:
element- The element.columnIndex- The zero-based index of the column in which error level is requested.- Returns:
- -1 for normal, 0=informational (not verified), 1=warning (undefined entry), 2=error.