public class CheckboxCellContentProvider extends TreePropertyCellContentProvider implements IButtonCellContentProvider
ICellContentProvider
for cells that display a
checkbox Button
.
Note: There is a limitation with embedding SWT widgets in a
TableViewer
. In particular, performance decreases due to the
number of widgets that may be involved. This class uses a workaround by
creating images for each state of a checkbox Button
. The states
are determined by combining enabled/disabled and selected/unselected (or
checked/unchecked). The four Image
s are registered with the JFace
ImageRegistry
and placed in each cell that is not currently being
edited.
Constructor and Description |
---|
CheckboxCellContentProvider(org.eclipse.jface.viewers.ColumnViewer viewer)
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
org.eclipse.swt.graphics.Image |
getImage(java.lang.Object element)
Provides a checkbox
Image depending on whether the cell is
enabled/disabled and selected/unselected. |
java.lang.String |
getToolTipText(java.lang.Object element)
Override the default tool tip to provide information about being enabled
or disabled.
|
java.lang.Object |
getValue(java.lang.Object element)
Returns true if the element is valid and the
TreeProperty 's
Entry 's tag is not "false" (case ignored), false otherwise. |
boolean |
isEnabled(java.lang.Object element)
The cell is enabled if the
TreeProperty 's Entry is
required, otherwise it is disabled. |
boolean |
isSelected(java.lang.Object element)
The cell is selected if its
TreeProperty 's Entry 's tag is
set to "true", false otherwise. |
boolean |
setValue(java.lang.Object element,
java.lang.Object value)
Sets the
TreeProperty 's Entry 's tag to "true" if the
value is true and "false" otherwise. |
getDescription, getText, isValid
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getText, isValid
public CheckboxCellContentProvider(org.eclipse.jface.viewers.ColumnViewer viewer)
viewer
- The viewer whose contents are managed by this provider.public boolean isEnabled(java.lang.Object element)
TreeProperty
's Entry
is
required, otherwise it is disabled.isEnabled
in interface ICellContentProvider
isEnabled
in class TreePropertyCellContentProvider
element
- The element to test.public boolean isSelected(java.lang.Object element)
TreeProperty
's Entry
's tag is
set to "true", false otherwise.isSelected
in interface IButtonCellContentProvider
element
- The element to test.public java.lang.String getToolTipText(java.lang.Object element)
getToolTipText
in interface ICellContentProvider
getToolTipText
in class TreePropertyCellContentProvider
element
- The element that needs a tool tip.null
.public org.eclipse.swt.graphics.Image getImage(java.lang.Object element)
Image
depending on whether the cell is
enabled/disabled and selected/unselected.getImage
in interface ICellContentProvider
getImage
in class TreePropertyCellContentProvider
element
- The element that needs a cell Image
.Image
for the cell, or null if Image
s are not supported.public java.lang.Object getValue(java.lang.Object element)
TreeProperty
's
Entry
's tag is not "false" (case ignored), false otherwise.getValue
in interface ICellContentProvider
getValue
in class TreePropertyCellContentProvider
element
- The element whose value is requested.public boolean setValue(java.lang.Object element, java.lang.Object value)
TreeProperty
's Entry
's tag to "true" if the
value is true and "false" otherwise.setValue
in interface ICellContentProvider
setValue
in class TreePropertyCellContentProvider
element
- The element whose value is being set.value
- The value that should be set for the element. This is expected
to match the underlying element's value type.