Class TreeView#
Defined in File TreeView.h
Nested Relationships#
Nested Types#
Inheritance Relationships#
Base Type#
public Karana::WebUI::Widget(Class Widget)
Class Documentation#
-
class TreeView : public Karana::WebUI::Widget#
Widget displaying an interactable tree using hierarchical html.
Although the class is named TreeView, general acyclic graphs are supported. In this case a Node and its descendants will appear under each of its parents.
Public Types
Public Functions
-
TreeView(Router &router, const NodeList &nodes = {}, const EdgeList &edges = {}, std::function<void(const Selection&)> on_select = {}, std::function<void()> on_refresh = {}, const Karana::Core::ks_ptr<State> &selection = nullptr)#
TreeView constructor.
- Parameters:
router – The connection router to use
nodes – The initial list of nodes in the tree
edges – The initial list of edges in the tree
on_select – Called when a node is selected in the UI
on_refresh – Called when a node is refreshed in the UI
selection – Optional existing State for the selection
-
void select(const Selection &selection = Selection{})#
Select the given items.
Note that calling this does not invoke the on_select callback passed into the constructor
- Parameters:
selection – The new Selection
-
void setNodeLabel(Karana::Core::id_t id, std::string_view label)#
Update the label for the node with the given id.
- Parameters:
id – The node id.
label – The new label text for the node.
Protected Functions
-
virtual void _onConnect(int client_id) override#
First setup on initial connection.
- Parameters:
client_id – The ID of the client connecting.
-
virtual void _onMessage(std::string_view message, int client_id) override#
Used to handle refresh messages.
- Parameters:
message – The refresh message.
client_id – The ID of the client to refresh.
-
TreeView(Router &router, const NodeList &nodes = {}, const EdgeList &edges = {}, std::function<void(const Selection&)> on_select = {}, std::function<void()> on_refresh = {}, const Karana::Core::ks_ptr<State> &selection = nullptr)#