Wt facet

Table of Contents

Wt entity UI components live in ores.wt.service under src/app/ and follow a three-part structure: a list widget (table + toolbar + signals), a detail dialog (form binding for create/edit), and integration into the application's navigation and service layer. All UI components use Wt signal/slot for parent–child communication; the parent page or controller connects the signals and calls the service. Return to Knowledge.

Codegen gap

No codegen profile exists for this layer. Before creating Wt UI components for any new entity:

  1. Create mustache templates in projects/ores.codegen/library/templates/.
  2. Add a wt profile entry to facet_catalogue.org.
  3. Validate against an existing entity (e.g. currency).
  4. Only then use codegen to generate the layer.

Until the profile exists, see the recipes for the manual path — but treat this as a workaround, not the target state.

List widget layout

The list widget inherits Wt::WContainerWidget and is final. It exposes set_{entities}(...) and refresh(), plus four signals: add_requested(), refresh_requested(), edit_requested(std::string) (passes primary key), and delete_requested(std::string). Private helpers setup_toolbar(), setup_table(), populate_table() build the layout.

The companion *_row struct is a lightweight display-only struct containing only the fields needed for the table (primary key, name, version, etc.).

Detail dialog layout

The detail dialog inherits Wt::WDialog and is final. It exposes set_{entity}(const domain::{entity}&) to populate for edit, get_{entity}() const to read back the edited values, and a save_requested() signal. One WLineEdit or WComboBox per editable field.

Application integration

  1. Add the list widget and service member to the page or controller class.
  2. Connect signals: add_requested() → open dialog; edit_requested() → populate dialog; save_requested() → call service; delete_requested() → confirm + call service.
  3. Register the page/controller in the application's navigation setup.

File locations

File Path
Row struct + list widget header include/ores.wt.service/app/{entity}_list_widget.hpp
List widget implementation src/app/{entity}_list_widget.cpp
Detail dialog header include/ores.wt.service/app/{entity}_dialog.hpp
Detail dialog implementation src/app/{entity}_dialog.cpp
Page / integration src/app/{entity}_page.cpp (or equivalent)

See also

Emacs 29.1 (Org mode 9.6.6)