Class ModelTree

class ooodev.dialog.dl_control.model.model_tree.ModelTree(model)[source]

Bases: ModelPropPartial, TreeControlModelPartial, ModelDialogElementPartial

__init__(model)[source]

Constructor

Parameters:
  • component (UnoControlModel) – UNO Component that implements com.sun.star.awt.UnoControlModel service.

  • model (com.sun.star.awt.UnoControlModel) –

Return type:

None

add_event_listener(listener)

Adds an event listener to the component.

Parameters:

listener (XEventListener) – The event listener to be added.

Return type:

None

add_property_change_listener(name, listener)

Adds a listener for property changes.

Parameters:
  • name (str) – The name of the property.

  • listener (Any) – The listener to be added.

Return type:

None

add_vetoable_change_listener(name, listener)

Adds a listener for vetoable changes.

Parameters:
  • name (str) – The name of the property.

  • listener (Any) – The listener to be added.

Return type:

None

create_clone()

Creates a clone of the object.

Returns:

The clone.

Return type:

XCloneable

dispose()

Disposes the component.

Return type:

None

get_property_set_info()

Returns the property set info.

Returns:

The property set info.

Return type:

XPropertySetInfo

get_property_value(name)

Returns the value of a property.

Parameters:

name (str) – The name of the property.

Returns:

The value of the property.

Return type:

Any

remove_event_listener(listener)

Removes an event listener from the component.

Parameters:

listener (XEventListener) – The event listener to be removed.

Return type:

None

remove_property_change_listener(name, listener)

Removes a listener for property changes.

Parameters:
  • name (str) – The name of the property.

  • listener (Any) – The listener to be removed.

Return type:

None

remove_vetoable_change_listener(name, listener)

Removes a listener for vetoable changes.

Parameters:
  • name (str) – The name of the property.

  • listener (Any) – The listener to be removed.

Return type:

None

set_property_value(name, value)

Sets the value of a property.

Parameters:
  • name (str) – The name of the property.

  • value (Any) – The value of the property.

Return type:

None

property context_writing_mode: int

Get or set the context_writing_mode property.

Return type:

int

property data_model: com.sun.star.awt.tree.XTreeDataModel

Specifies the XTreeDataModel that is providing the hierarchical data.

You can implement your own instance of XTreeDataModel or use the MutableTreeDataModel.

Return type:

XTreeDataModel

property editable: bool

Gets/Sets whether the nodes of the tree are editable.

The default value is False.

Return type:

bool

property enable_visible: bool

Get or set the enable_visible property.

Return type:

bool

property invokes_stop_node_editing: bool

Gets/Sets what happens when editing is interrupted by selecting another node in the tree, a change in the tree’s data, or by some other means.

Setting this property to True causes the changes to be automatically saved when editing is interrupted. False means that editing is canceled and changes are lost

The default value is False.

Return type:

bool

property model: com.sun.star.awt.UnoControlModel

Uno Control Model

Return type:

UnoControlModel

property picture: str

Gets/Sets the picture for the control

When setting the value it can be a string or a Path object. If a string is passed it can be a URL or a path to a file. Value such as file:///path/to/image.png and /path/to/image.png are valid. Relative paths are supported.

Returns:

The picture URL in the format of file:///path/to/image.png or empty string if no picture is set.

Return type:

str

property root_displayed: bool

Gets/Sets if the root node of the tree is displayed.

If RootDisplayed is set to False, the root node of a model is no longer a valid node for the XTreeControl and can’t be used with any method of XTreeControl.

The default value is True.

Return type:

bool

property row_height: UnitPX

Gets/Sets the height of each row, in pixels units.

If the specified value is less than or equal to zero, the row height is the maximum height of all rows.

The default value is 0

Returns:

Row height in pixels.

Return type:

UnitPX

Note

Value can be set as an integer or a UnitPX instance.

property selection_type: SelectionType

Gets/Sets the selection mode that is enabled for this tree.

The default value is com.sun.star.view.SelectionType.NONE

Hint

  • SelectionType can be imported from ooo.dyn.view.selection_type

Return type:

SelectionType

property shows_handles: bool

Gets/Sets whether the node handles should be displayed. The handles are doted lines that visualize the tree like hierarchy.

The default value is True.

Return type:

bool

property shows_root_handles: bool

Gets/Sets whether the node handles should also be displayed at root level.

The default value is True.

Return type:

bool