Class CtlTree

Introduction

Class for working with tree controls in a dialog.

EventArgsCallbackT

All EventArgsCallbackT callbacks include control_src as a keyword argument.

A callback can be in the format of:

def on_some_event(
    src: Any, event: EventArgs, control_src: CtlTree, *args, **kwargs
) -> None:
    pass

or

def on_some_event(src: Any, event: EventArgs, *args, **kwargs) -> None:
    # can get control from kwargs
    ctl = cast(CtlTree, kwargs['control_src'])

Example

Tab and Dialog Example

For an example see Tab and Tree Dialog Example

Class

class ooodev.dialog.dl_control.CtlTree(ctl)[source]

Bases: DialogControlBase, TreeControlModelPartial, SelectionChangeEvents, TreeEditEvents, TreeExpansionEvents

Class for Tree Control

__init__(ctl)[source]

Constructor

Parameters:

ctl (TreeControl) – Tree Control

Return type:

None

add_event_focus_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_focus_gained(cb)

Adds a listener for an event.

Event is invoked when a window gains the keyboard focus.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.FocusEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_focus_lost(cb)

Adds a listener for an event.

Event is invoked when a window loses the keyboard focus.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.FocusEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_key_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_key_pressed(cb)

Adds a listener for an event.

Event is invoked when a key has been pressed.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.KeyEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_key_released(cb)

Adds a listener for an event.

Event is invoked when a key has been released.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.KeyEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_listener(listener)

Adds an event listener to the component.

Parameters:

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

Return type:

None

add_event_mouse_dragged(cb)

Adds a listener for an event.

Event is invoked when a mouse button is pressed on a window and then dragged.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.MouseEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_mouse_entered(cb)

Adds a listener for an event.

Event is invoked when the mouse enters a window.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.MouseEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_mouse_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_mouse_exited(cb)

Adds a listener for an event.

Event is invoked when the mouse exits a window.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.MouseEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_mouse_motion_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_mouse_moved(cb)

Adds a listener for an event.

Event Is invoked when the mouse pointer has been moved on a window (with no buttons down).

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.MouseEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_mouse_pressed(cb)

Adds a listener for an event.

Event is invoked when a mouse button has been pressed on a window.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.MouseEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_mouse_released(cb)

Adds a listener for an event.

Event is invoked when a mouse button has been released on a window.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.MouseEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_node_edited(cb)

Adds a listener for an event.

Event is invoked from the TreeControl implementation when editing of Node is finished and was not canceled.

Note

The callback EventArgs.event_data will contain a NodeEditedArgs object.

Return type:

None

Parameters:

cb (Any) –

add_event_node_editing(cb)

Adds a listener for an event.

Event is invoked after a tab page was activated.

The callback EventArgs.event_data will contain a UNO object that implements XTreeNode.

Return type:

None

Parameters:

cb (Any) –

add_event_observers(*args)

Adds observers that gets their trigger method called when this class trigger method is called.

Parameters:

args (EventObserver) – One or more observers to add.

Return type:

None

Note

Observers are removed automatically when they are out of scope.

add_event_paint_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_properties_change(names, cb)

Add properties to listen for changes.

Parameters:
  • names (Iterable[str]) – One or more property names to listen for changes.

  • cb (EventArgsCallbackT) – Callback that is invoked when an event is triggered.

Raises:

ValueError – If names is empty.

Return type:

None

Note

The callback EventArgs.event_data will contain a tuple of com.sun.star.beans.PropertyChangeEvent objects.

Each time this method is called, the previous names are removed and the new names are added.

add_event_property_change(name, cb)

Adds a listener for an event.

Event is invoked when property is changed.

The callback EventArgs.event_data will contain a com.sun.star.beans.PropertyChangeEvent struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

add_event_property_change_events_disposing(name, cb)

Adds a listener for an event.

Event is invoked when the property listener is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

add_event_request_child_nodes(cb)

Adds a listener for an event.

Event is invoked when a node with children on demand is about to be expanded.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.tree.TreeExpansionEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_selection_change_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_selection_changed(cb)

Adds a listener for an event.

Event is invoked when the selection changes.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_tree_collapsed(cb)

Adds a listener for an event.

Event is invoked whenever a node in the tree has been successfully collapsed.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.tree.TreeExpansionEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_tree_collapsing(cb)

Adds a listener for an event.

Event is invoked whenever a node in the tree is about to be collapsed.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.tree.TreeExpansionEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_tree_edit_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_tree_expanded(cb)

Adds a listener for an event.

Event is invoked whenever a node in the tree has been successfully expanded.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.tree.TreeExpansionEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_tree_expanding(cb)

Adds a listener for an event.

Event is invoked whenever a node in the tree is about to be expanded.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.tree.TreeExpansionEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_tree_expansion_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_vetoable_change(name, cb)

Adds a listener for an event.

Event is invoked when property is changed.

The callback EventArgs.event_data will contain a com.sun.star.beans.PropertyChangeEvent struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

add_event_vetoable_change_events_disposing(name, cb)

Adds a listener for an event.

Event is invoked when the property listener is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

add_event_window_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_window_hidden(cb)

Adds a listener for an event.

Event is invoked when the window has been hidden.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.WindowEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_window_moved(cb)

Adds a listener for an event.

Event is invoked when the window has been moved.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.WindowEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_window_paint(cb)

Adds a listener for an event.

Event Is invoked when a region of the window became invalid, e.g. when another window has been moved away.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.PaintEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_window_resized(cb)

Adds a listener for an event.

Event is invoked when the window has been resized.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.WindowEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_window_shown(cb)

Adds a listener for an event.

Event is invoked when the window has been shown.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.WindowEvent struct.

Return type:

None

Parameters:

cb (Any) –

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_sub_node(parent_node, display_value='', data_value=None)[source]

Adds a sub node to the parent node

Parameters:
  • parent_node (XMutableTreeNode) – Parent node

  • display_value (str, optional) – display value for the Node.

  • data_value (Any, optional) – Specifies any value associated with the node. Must be a type understood by UNO, such as a string, int, float, a struct such as UnoDateTime, etc. Defaults to None.

Returns:

MutableTreeNode

Return type:

XMutableTreeNode

add_sub_tree(flat_tree, parent_node=None)[source]

Adds a sub tree to the parent node

Parameters:
  • parent_node (XMutableTreeNode) – Parent node.

  • flat_tree (Sequence[Sequence[str]]) – FlatTree: a 2D sequence of strings, sorted on the columns containing the DisplayValues

  • width_data (bool, optional) – _description_. Defaults to False.

Return type:

None

Note

The same data structure for tree_data can be used to add sub-nodes as shown in convert_to_tree().

Return type:

None

Parameters:
  • flat_tree (Sequence[Any]) –

  • parent_node (XMutableTreeNode | 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

apply_styles(*styles)

Applies styles to control

Parameters:

*styles (StyleT) – Styles to apply

Return type:

None

convert_to_tree(flat_tree)[source]

Converts a flat tree to a tree

Parameters:

flat_tree (Sequence[Sequence[str]]) – FlatTree: a 2D sequence of strings, sorted on the columns containing the DisplayValues

Returns:

A tree

Return type:

dict

Notes

The flat tree can be a sequence of sequence of strings or a sequence of sequence of sequence.

Example sequence of sequence of strings:

This example uses a List of List of strings. It would alo work with a tuple of tuple of strings.

[
    ["A1", "B1", "C1"],
    ["A1", "B1", "C2"],
    ["A1", "B2", "C3"],
    ["A2", "B3", "C4"],
    ["A2", "B3", "C5"],
    ["A2", "B3", "C6"],
    ["A2", "B4", "Razor"],
]

The result will be as follows:

Tree Control

Example sequence of sequence of sequence:

This example uses includes data values that are to be assigned to the nodes.

Data values can be any type understood by UNO, such as a string, int, float, a struct such as UnoDateTime, etc. List and tuple can be interchanged and still work.

In this example A1 will have a data value of 1 and B1 will have a data value of now_date. The first data value that is encountered will be assigned to the node’s DataValue property. All other data values for that node will be ignored.

now_date = DateUtil.date_to_uno_date_time(datetime.datetime.now())

[
    [("A1", 1), ("B1", now_date), ("C1", None)],
    [("A1", "ignored"), ("B1", None), ("C2", "Data4")],
    [("A1",), ("B2", "Data5"), ("C3", "Data6")],
    [("A2", 33), ("B3", "Data8"), ("C4", "Data9")],
    [("A2", "Data7"), ("B3", "Data8"), ("C5", "Data10")],
    [("A2", "Data7"), ("B3", "Data8"), ("C6", "Data11")],
]

The result will be as follows:

Tree Control

The B1 Node will look something like this:

Tree Control

The input is rather flexible. The following would also work:

Note that A2 contains too many values. The first two will be used and the rest ignored. The A2 node will have a text value of A2 and a data value of 33.

[
    [["A1", 1], ["B1", now_date], ["C1"]],
    [["A1"], ["B1"], ["C2"]],
    [["A1"], ["B2"], ["C3"]],
    [["A2", 33, 66, 127], ["B3", "Data8"], ["C4", "Data9"]],
    [["A2"], ["B3", "Data8"], ["C5", "Data10"]],
    [["A2"], ["B3", None], ["C6", "Data11"]],
]

See also

add_nodes_from_tree_data()

static create(win, **kwargs)[source]

Creates a new instance of the control.

Keyword arguments are optional. Extra Keyword args are passed to the control as property values.

Parameters:
  • win (XWindowPeer) – Parent Window

  • kwargs (Any) –

Keyword Arguments:
Returns:

New instance of the control.

Return type:

CtlTree

Note

The UnoControlDialogElement interface is not included when creating the control with a window peer.

create_clone()

Creates a clone of the object.

Returns:

The clone.

Return type:

XCloneable

create_root(display_value, data_value=None)[source]

Creates a root node for the tree

Parameters:
  • display_value (str) – Display value for the root node.

  • data_value (Any, optional) – Specifies any value associated with the node. Must be a type understood by UNO, such as a string, int, float, a struct such as UnoDateTime, etc. Defaults to None.

Returns:

Returns a new root node of the tree control.

Return type:

XMutableTreeNode

dispose()

Disposes the component.

Return type:

None

find_node(node, value, case_sensitive=False, search_data_value=True)[source]

Perform a search on a tree from a given node, looking for a node with a specific value.

Parameters:
  • node (XTreeNode) – Node to start search from.

  • value (str) – Value to search for.

  • case_sensitive (bool, optional) – Specifies if the search is case sensitive. Defaults to False.

  • search_data_value (bool, optional) – Specifies if DataValue of nodes are to be include in search. Defaults to True.

Returns:

Tree node if found; Otherwise, None.

Return type:

XTreeNode | None

Note

SearchTree is a much more powerful search tool. It can be used to search for other types of match such as regular expressions.

Custom rules can be created if the exiting rules do no cover you search needs.

See also

tree_search

fire_event_properties_change(names)

Fires a sequence of PropertyChangeEvents

Parameters:

names (Iterable[str]) – Sequence of property names to fire event for.

Return type:

None

getImplementationId()
getTypes()
get_control_kind()[source]

Gets the control kind. Returns DialogControlKind.TREE

Return type:

DialogControlKind

get_control_named_kind()[source]

Gets the control named kind. Returns DialogControlNamedKind.TREE

Return type:

DialogControlNamedKind

get_control_props()

Gets property set for a control model

Parameters:

control_model (Any) – control model

Returns:

Property set

Return type:

XPropertySet | None

get_model()[source]

Gets the Model for the control

Return type:

TreeControlModel

get_property_set()

Gets the property set for this control

Return type:

XPropertySet

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

get_uno_srv_name()[source]

Returns com.sun.star.awt.TreeControl

Return type:

str

get_view()
Return type:

XControl

get_view_ctl()[source]
Return type:

TreeControl

remove_event_focus_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_focus_gained(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_focus_lost(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_key_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_key_pressed(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_key_released(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (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_event_mouse_dragged(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_mouse_entered(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_mouse_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_mouse_exited(cb)

Removes a listener for an event.

Return type:

None

Parameters:

cb (Any) –

remove_event_mouse_motion_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_mouse_moved(cb)

Removes a listener for an event.

Return type:

None

Parameters:

cb (Any) –

remove_event_mouse_pressed(cb)

Removes a listener for an event.

Event is invoked when a mouse button has been pressed on a window.

Return type:

None

Parameters:

cb (Any) –

remove_event_mouse_released(cb)

Removes a listener for an event.

Return type:

None

Parameters:

cb (Any) –

remove_event_node_edited(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_node_editing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_observer(observer)

Removes an observer

Parameters:

observer (EventObserver) – One or more observers to add.

Returns:

True if observer has been removed; Otherwise, False.

Return type:

bool

remove_event_paint_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_properties_listener()

Remove Properties Listener

Return type:

None

remove_event_property_change(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

remove_event_property_change_events_disposing(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

remove_event_request_child_nodes(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_selection_change_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_selection_changed(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_tree_collapsed(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_tree_collapsing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_tree_edit_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_tree_expanded(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_tree_expanding(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_tree_expansion_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_vetoable_change(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

remove_event_vetoable_change_events_disposing(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

remove_event_window_events_disposing(cb)

Removes a listener for an event.

Return type:

None

Parameters:

cb (Any) –

remove_event_window_hidden(cb)

Removes a listener for an event.

Return type:

None

Parameters:

cb (Any) –

remove_event_window_moved(cb)

Removes a listener for an event.

Return type:

None

Parameters:

cb (Any) –

remove_event_window_paint(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_window_resized(cb)

Removes a listener for an event.

Return type:

None

Parameters:

cb (Any) –

remove_event_window_shown(cb)

Removes a listener for an event.

Return type:

None

Parameters:

cb (Any) –

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

subscribe_event(event_name, callback)

Add an event listener to current instance.

Parameters:
  • event_name (str) – Event Name.

  • callback (EventCallback) – Callback of the event listener.

Return type:

None

trigger_event(event_name, event_args)

Trigger an event on current instance.

Parameters:
  • event_name (str) – Event Name.

  • event_args (EventArgsT) – Event Args.

Return type:

None

unsubscribe_event(event_name, callback)

Remove an event listener from current instance.

Parameters:
  • event_name (str) – Event Name.

  • callback (EventCallback) – Callback of the event listener.

Return type:

None

DATA_VALUE_KEY = '___data_value___'
property current_selection: MutableTreeNode | None

Gets the current selected node

Return type:

MutableTreeNode | None

property data_model: TreeDataModelComp | None

Gets the data model for the tree

Return type:

TreeDataModelComp | None

property editable: bool

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

The default value is False.

Return type:

bool

property event_observer: EventObserver

Gets/Sets The Event Observer for this instance.

Return type:

EventObserver

property events_listener_focus: FocusListener

Returns listener

Return type:

FocusListener

property events_listener_key: KeyListener

Returns listener

Return type:

KeyListener

property events_listener_mouse: MouseListener

Returns listener

Return type:

MouseListener

property events_listener_mouse_motion: MouseMotionListener

Returns listener

Return type:

MouseMotionListener

property events_listener_paint: PaintListener

Returns listener

Return type:

PaintListener

property events_listener_properties_change_implement: PropertiesChangeListener

Returns listener

Return type:

PropertiesChangeListener

property events_listener_selection_change: SelectionChangeListener

Returns listener

Return type:

SelectionChangeListener

property events_listener_tree_edit: TreeEditListener

Returns listener

Return type:

TreeEditListener

property events_listener_tree_expansion: TreeExpansionListener

Returns listener

Return type:

TreeExpansionListener

property events_listener_window: WindowListener

Returns listener

Return type:

WindowListener

property help_text: str

Gets/Sets the tip text

Return type:

str

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 lo_inst: LoInst

Lo Instance

Return type:

LoInst

property model: com.sun.star.awt.tree.TreeControlModel

Uno Control Model

Return type:

TreeControlModel

property model_ex: ModelTree

Gets the extended Model for the control.

This is a wrapped instance for the model property. It add some additional properties and methods to the model.

Return type:

ModelTree

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 root_node: MutableTreeNode | None

Gets the root node of the tree

Return type:

MutableTreeNode | None

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

property tip_text: str

Gets/Sets the tip text

Return type:

str

property view: com.sun.star.awt.tree.TreeControl

Uno Control

Return type:

TreeControl

property visible: bool

Gets/Sets the visible state for the control

Return type:

bool