new BaseEditor()
Property editor is association object to edit property row in
object inspector (similar to Delphi's property editor).
This is the base class of all property editors, containing a series of methods
that can be overrided to implement different styles of editors.
Properties:
Name | Type | Description |
---|---|---|
objects |
Array | Objects currently been edited in object inspector and this property editor. |
propInfo |
Object | Information object of current property. |
propName |
Variant | Name of current property. Readonly. Usually it is a string, but it may also be a int index when object is an array. |
propType |
Variant | Type of current property. Readonly. //@property {Variant} originalValue Old value of property. |
parentEditor |
Kekule.PropertyEditor.BaseEditor | Parent property editor. This property usually should be set by expandable parent editor. When child property is modified, child will notify parent that the property has been changed. |
valueTextMode |
Int | Value from Kekule.Widget.ValueListEditor.ValueDisplayMode. Simple or JSON, different value may cause different output text in object inspector. |
readOnly |
Bool | Whether this editor is read only. If this value is set to null or undefined, actual read only value will be calculated automatically based on property info. |
allowEmpty |
Bool | Whether property value can be set to null when value text is set to ''. Note that the effect of this property need to be implemented in concrete editor classes, especially in saveEditValue method. |
Extends
- ObjectEx
Methods
-
createEditWidget(parentWidget) → {Kekule.Widget.BaseWidget}
-
Create a custom edit widget and put old property value in it.
Parameters:
Name Type Description parentWidget
Kekule.Widget.BaseWidget Returns:
-
doCreateEditWidget(parentWidget) → {Kekule.Widget.BaseWidget}
-
Do actual work of createEditWidget. Descendants should override this method.
Parameters:
Name Type Description parentWidget
Kekule.Widget.BaseWidget //@param {Variant} propValue Returns:
-
getAttributes() → {Int}
-
Returns attribute of editor. Different attribute causes different behavior and outlook in object inspector. Descendants may override this method.
Returns:
- Type
- Int
-
getDescription() → {String}
-
Returns property description. Usually propInfo.description. Descendants seldom need to override this method.
Returns:
- Type
- String
-
getEditWidget() → {Kekule.Widget.BaseWidget}
-
Returns currently created edit widget.
Returns:
-
getHint() → {String}
-
Returns property hint to display in object inspector. Usually this value is same with getTitle(). Descendants seldom need to override this method.
Returns:
- Type
- String
-
getSubPropertyEditors(propScopes) → {Array}
-
Returns child property editors. This method will be used when SUBPROPS flag in property editor's attribute. In object inspector, rows will be expanded according to child property editors. Descendants may override this method.
Parameters:
Name Type Description propScopes
Array Returns:
- Type
- Array
-
getTitle() → {String}
-
Returns property title to display in object inspector. Usually propInfo.title or propInfo.name. Descendants seldom need to override this method.
Returns:
- Type
- String
-
getValue() → {Variant}
-
Returns property value of all objects. Descendants may override this method.
Returns:
- Type
- Variant
-
getValueText() → {String}
-
Returns display text of property value. Descendants may override this method.
Returns:
- Type
- String
-
hasSubPropertyEditors() → {Bool}
-
Whether the editor has sub property editors.
Returns:
- Type
- Bool
-
isReadOnly() → {Bool}
-
Whether the editor is a read only one.
Returns:
- Type
- Bool
-
notifyChildEditorValueChange(fieldName, fieldValue)
-
This method is called by child property editor (such as enum item editor) to notify the child property has been changed.
Parameters:
Name Type Description fieldName
fieldValue
-
saveEditValue() → {Variant}
-
Save edit value in edit widget back to property. If the original value is not changed, false should be returned. Else true should be returned.
Returns:
- Type
- Variant
-
setValue(value)
-
Save property value back to objects.
Parameters:
Name Type Description value
Variant