public class PropertySheetEntry extends EventManager implements IPropertySheetEntry
PropertySheetEntry
is an implementation of
IPropertySheetEntry
which uses IPropertySource
and IPropertyDescriptor
to interact with domain model objects.
Every property sheet entry has a single descriptor (except the root entry which has none). This descriptor determines what property of its objects it will display/edit.
Entries do not listen for changes in their objects. Since there is no restriction on properties being independent, a change in one property may affect other properties. The value of a parent's property may also change. As a result we are forced to refresh the entire entry tree when a property changes value.
FILTER_ID_EXPERT
Constructor and Description |
---|
PropertySheetEntry() |
Modifier and Type | Method and Description |
---|---|
void |
addPropertySheetEntryListener(IPropertySheetEntryListener listener)
Adds the given listener to this entry's collection of listeners.
|
void |
applyEditorValue()
Apply the current cell editor value.
|
protected PropertySheetEntry |
createChildEntry()
Factory method to create a new child
PropertySheetEntry
instance. |
void |
dispose()
Called when the entry is no longer needed
|
protected Color |
getBackground()
Returns the background color for the entry.
|
String |
getCategory()
Returns the entry's category.
|
IPropertySheetEntry[] |
getChildEntries()
Returns the child entries for this entry.
|
String |
getDescription()
Return a short description of the property sheet entry.
|
protected IPropertyDescriptor |
getDescriptor()
Returns the descriptor for this entry.
|
String |
getDisplayName()
Returns the name used to display the property.
|
CellEditor |
getEditor(Composite parent)
Return the
CellEditor used to edit the property. |
protected Object |
getEditValue(int index)
Returns the edit value for the object at the given index.
|
String |
getErrorText()
Returns the error text to display if the value is invalid.
|
String[] |
getFilters()
Return the filter ids used to group entries into levels such as Expert.
|
protected Font |
getFont()
Returns the font for the entry.
|
protected Color |
getForeground()
Returns the foreground color for the entry.
|
Object |
getHelpContextIds()
Returns the help context id for this entry, or
null if
this entry has no help context id. |
Image |
getImage()
Returns the image for the property value, if there is one.
|
protected PropertySheetEntry |
getParent()
Returns the parent of this entry.
|
protected IPropertySource |
getPropertySource(Object object)
Returns an property source for the given object.
|
String |
getValueAsString()
Returns the value of the objects expressed as a String.
|
Object[] |
getValues()
Returns the value objects of this entry.
|
boolean |
hasChildEntries()
Returns
true if the entry has children. |
protected void |
refreshFromRoot()
Refresh the entry tree from the root down.
|
void |
removePropertySheetEntryListener(IPropertySheetEntryListener listener)
Removes the given listener from this entry's collection of listeners.
|
void |
resetPropertyValue()
Resets the property value to its default value if it has been changed.
|
void |
setPropertySourceProvider(IPropertySourceProvider provider)
Sets a property source provider for this entry.
|
void |
setValues(Object[] objects)
The
PropertySheetEntry implmentation of this method
declared onIPropertySheetEntry will obtain an editable
value for the given objects and update the child entries. |
protected void |
valueChanged(PropertySheetEntry child)
The value of the given child entry has changed.
|
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
public void addPropertySheetEntryListener(IPropertySheetEntryListener listener)
IPropertySheetEntry
addPropertySheetEntryListener
in interface IPropertySheetEntry
listener
- the listener to addpublic void applyEditorValue()
IPropertySheetEntry
applyEditorValue
in interface IPropertySheetEntry
protected PropertySheetEntry createChildEntry()
PropertySheetEntry
instance.
Subclasses may overwrite to create new instances of their own class.
PropertySheetEntry
instance for the
descriptor passed inpublic void dispose()
IPropertySheetEntry
dispose
in interface IPropertySheetEntry
public String getCategory()
IPropertySheetEntry
getCategory
in interface IPropertySheetEntry
public IPropertySheetEntry[] getChildEntries()
IPropertySheetEntry
getChildEntries
in interface IPropertySheetEntry
public String getDescription()
IPropertySheetEntry
getDescription
in interface IPropertySheetEntry
protected IPropertyDescriptor getDescriptor()
public String getDisplayName()
IPropertySheetEntry
getDisplayName
in interface IPropertySheetEntry
public CellEditor getEditor(Composite parent)
IPropertySheetEntry
CellEditor
used to edit the property.getEditor
in interface IPropertySheetEntry
parent
- the parent widget for the editorCellEditor
used to edit the propertyprotected Object getEditValue(int index)
index
- the value object indexpublic String getErrorText()
IPropertySheetEntry
getErrorText
in interface IPropertySheetEntry
null
public String[] getFilters()
IPropertySheetEntry
getFilters
in interface IPropertySheetEntry
public Object getHelpContextIds()
IPropertySheetEntry
null
if
this entry has no help context id.
NOTE: Help support system API's changed since 2.0 and arrays of contexts are no longer supported.
Thus the only valid non- null
return type for this method
is a String
representing a context id. The previously
valid return types are deprecated. The plural name for this method is
unfortunate.
getHelpContextIds
in interface IPropertySheetEntry
public Image getImage()
IPropertySheetEntry
getImage
in interface IPropertySheetEntry
null
protected PropertySheetEntry getParent()
null
if it has no parentprotected IPropertySource getPropertySource(Object object)
object
- an object for which to obtain a property source or
null
if a property source is not availablepublic String getValueAsString()
IPropertySheetEntry
getValueAsString
in interface IPropertySheetEntry
public Object[] getValues()
public boolean hasChildEntries()
IPropertySheetEntry
true
if the entry has children.hasChildEntries
in interface IPropertySheetEntry
true
if the entry has childrenprotected void refreshFromRoot()
public void removePropertySheetEntryListener(IPropertySheetEntryListener listener)
IPropertySheetEntry
removePropertySheetEntryListener
in interface IPropertySheetEntry
listener
- the listener to removepublic void resetPropertyValue()
IPropertySheetEntry
Does nothing if the notion of a default value is not meaningful for the property.
resetPropertyValue
in interface IPropertySheetEntry
public void setPropertySourceProvider(IPropertySourceProvider provider)
IPropertySource
for each of this entries
objects. If no provider is set then a default provider is used.provider
- IPropertySourceProviderpublic void setValues(Object[] objects)
PropertySheetEntry
implmentation of this method
declared onIPropertySheetEntry
will obtain an editable
value for the given objects and update the child entries.
Updating the child entries will typically call this method on the child entries and thus the entire entry tree is updated
setValues
in interface IPropertySheetEntry
objects
- the new values for this entryprotected void valueChanged(PropertySheetEntry child)
We must inform our parent so that it can update its value objects
Subclasses may override to set the property value in some custom way.
child
- the child entry that changed its valueprotected Color getForeground()
null
to use the default
foreground colorprotected Color getBackground()
null
to use the default
background colorprotected Font getFont()
null
to use the default font
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.