![]() |
Webdar 1.0.0
Web user interface to libdar
|
class html_form_dynamic_table web user dynamically add new lines in a table More...
#include <html_form_dynamic_table.hpp>
Classes | |
class | iterator |
Public Member Functions | |
html_form_dynamic_table (bool has_left_labels, bool selector_below, const std::string &adder_text, const std::string &adder_default_choice) | |
default event name for all object of this clas More... | |
html_form_dynamic_table (const html_form_dynamic_table &ref)=delete | |
html_form_dynamic_table (html_form_dynamic_table &&ref) noexcept=delete | |
html_form_dynamic_table & | operator= (const html_form_dynamic_table &ref)=delete |
html_form_dynamic_table & | operator= (html_form_dynamic_table &&ref) noexcept=delete |
iterator | begin () const |
iterator | end () const |
iterator | last () const |
bool | empty () const |
whether the current dynamic_table is empty | |
void | set_obj_type_provider (const html_form_dynamic_table_object_provider *provider) |
define a object provider More... | |
const html_form_dynamic_table_object_provider * | get_current_provider () const |
get the current object provider | |
void | set_obj_type_context (const std::string &ctxt) |
set context passed to the object provider More... | |
void | add_obj_type (const std::string &label) |
add a new object type to be proposed to the user from the "adder" selector More... | |
void | clear_obj_type () |
clear all object types added by mean of add_obj_type | |
unsigned int | obj_type_size () const |
return the number of object type available to the user | |
void | clear () |
clear table content | |
void | add_line (unsigned int typenum) |
manually add an line in the table with the object type give in number More... | |
virtual void | load_json (const json &source) override |
inherited from jsoner More... | |
virtual json | save_json () const override |
inherited from jsoner More... | |
virtual void | clear_json () override |
inherited from jsoner More... | |
virtual void | on_event (const std::string &event_name) override |
inherited from actor More... | |
void | css_border_collapsed (bool mode) |
exposed css method from underlying html_table | |
void | set_css_class_first_row (const std::string &val) |
exposed css method from underlying html_table | |
void | set_css_class_first_row () |
exposed css method from underlying html_table | |
void | set_css_class_first_column (const std::string &val) |
exposed css method from underlying html_table | |
void | set_css_class_first_column () |
exposed css method from underlying html_table | |
void | set_css_class_cells (const std::string &val) |
exposed css method from underlying html_table | |
void | set_css_class_cells () |
exposed css method from underlying html_table | |
![]() | |
html_div (const html_div &ref)=delete | |
html_div (html_div &&ref) noexcept=delete | |
html_div & | operator= (const html_div &ref)=delete |
html_div & | operator= (html_div &&ref) noexcept=delete |
![]() | |
html_level (const html_level &ref)=delete | |
html_level (html_level &&ref) noexcept=delete | |
html_level & | operator= (const html_level &ref)=delete |
html_level & | operator= (html_level &&ref) noexcept=delete |
void | adopt_static_html (const std::string &html) |
used in concurrency with body_builder::adopt() | |
void | clear_children () |
clear all adopted data | |
![]() | |
html_tooltip () | |
html_tooltip (const html_tooltip &ref)=default | |
html_tooltip (html_tooltip &&ref) noexcept=delete | |
html_tooltip & | operator= (const html_tooltip &ref)=default |
html_tooltip & | operator= (html_tooltip &&ref) noexcept=delete |
const std::string & | get_tooltip () const |
get the helper string to show as popup | |
void | set_tooltip (const std::string &helper) |
set the helper to the tooltip (helper popup) | |
![]() | |
body_builder () | |
constructor | |
body_builder (const body_builder &ref) | |
copy constructor More... | |
body_builder (body_builder &&ref) noexcept=delete | |
move constructor More... | |
body_builder & | operator= (const body_builder &ref) |
assignment operator drops all existing children More... | |
body_builder & | operator= (body_builder &&ref) noexcept=delete |
move operator More... | |
virtual | ~body_builder () |
the (virtual) destructor | |
void | set_prefix (const chemin &prefix) |
void | adopt (body_builder *obj) |
bool | is_adopted () const |
whether the object has currently a parent (= is adopted) | |
void | foresake (body_builder *obj) |
void | set_visible (bool mode) |
ask for the object to become visible in HTML page or temporarily hidden More... | |
bool | get_visible () const |
returns the current visible status of the object More... | |
bool | get_visible_recursively () const |
return the effective visible status of an object taking into account all of ancestors that adopted it | |
void | add_css_class (const std::string &name) |
set this object with a additional css_class (assuming it is defined in a css_library available for this object) | |
void | add_css_class (const css_class_group &cg) |
set this object with an additional set of css_classes (assuming they are all defined in a css_library available for this object) | |
bool | has_css_class (const std::string &name) const |
check the presence of the given class name | |
void | remove_css_class (const std::string &name) |
remove the provided css_class name from the list of css_class names this object has been assigned to | |
void | remove_css_class (const css_class_group &cg) |
remove the provided css_class_group from the list | |
void | clear_css_classes () |
clear the whole list of css_class names | |
const std::set< std::string > & | get_css_classes_as_a_set () const |
provide the list of css_class names that this object has been set with | |
css_class_group | get_css_class_group () const |
provide the list of css_class names as a css_class_group | |
std::string | get_css_classes (const std::string &extra="") const |
return the class_name as inlined css, suitable to be added in a html marker More... | |
void | define_css_class_in_library (const css_class &csscl) |
void | define_css_class_in_library (const std::string &name, const css &cssdef) |
bool | is_css_class_defined_in_library (const std::string &name) const |
check whether a css_class of given name already exists in a reachable css_library | |
std::string | get_body_part (const chemin &path, const request &req) |
void | ignore_body_changed_from_my_children (bool mode) |
ignore my_body_part_has_changed() invoked from adopted children and myself More... | |
bool | get_ignore_body_changed_from_my_children () const |
get the current status of ignore_body_changed_from_my_children() | |
void | set_no_CR (bool no_cr=true) |
ask for the implementation not to add a new line after this control More... | |
void | assign_anchor (bool mode) |
assign an anchor to this object (the object's inherited_get_body_part() will be wrapped into an HTML anchor: ) More... | |
std::string | get_assigned_anchor () const |
return the anchor value that has been assiged to this object (without the leading #) More... | |
virtual void | bind_to_anchor (const std::string &val) |
ask inherited components to use this anchor in case they redirect to an new URL or generate new URLs within their body part. More... | |
![]() | |
actor (const actor &ref)=default | |
actor (actor &&ref) noexcept(false)=default | |
actor & | operator= (const actor &ref)=default |
actor & | operator= (actor &&ref) noexcept(false) |
virtual void | on_event (const std::string &event_name)=0 |
implementation in inherited class of the action triggered by the event given in argument More... | |
![]() | |
reference () | |
usual constructor | |
reference (const reference &ref) | |
copy constructor More... | |
reference (reference &&ref) noexcept(false) | |
move constructor (only operational for objects without peering) More... | |
reference & | operator= (const reference &ref) |
assignment operator (only operational for objects without peering) More... | |
reference & | operator= (reference &&ref) noexcept(false) |
move assigment operator More... | |
virtual | ~reference () |
destructor | |
void | peer_with (reference *obj) |
method used to create a relation between two objects More... | |
void | break_peer_with (reference *obj) |
break the peering with the object given as argument | |
bool | is_peer (reference *obj) const |
whether a peering exists with that object | |
bool | is_empty () const |
whether the current object has peering | |
unsigned int | size () const |
the number of peers | |
![]() | |
events (const events &ref) | |
copy constructor More... | |
events (events &&ref) noexcept(false)=default | |
events & | operator= (const events &ref)=default |
events & | operator= (events &&ref) noexcept(false) |
void | record_actor_on_event (actor *ptr, const std::string &name) |
record an actor for an given event | |
![]() | |
jsoner (const jsoner &ref)=default | |
jsoner (jsoner &&ref) noexcept(false)=default | |
jsoner & | operator= (const jsoner &ref)=default |
jsoner & | operator= (jsoner &&ref) noexcept(false)=default |
virtual void | load_json (const json &source)=0 |
setup the components from the json provided information More... | |
virtual json | save_json () const =0 |
produce a json structure from the component configuration More... | |
virtual void | clear_json ()=0 |
instruct the object to get to its default/initial configuration More... | |
Static Public Attributes | |
static const std::string | changed = "html_form_dynamic_table_changed" |
Protected Member Functions | |
virtual std::string | inherited_get_body_part (const chemin &path, const request &req) override |
inherited methods from body_builder More... | |
virtual void | new_css_library_available () override |
inherited from body_builder More... | |
virtual std::string | inherited_get_body_part (const chemin &path, const request &req) override |
inherited from body_builder More... | |
![]() | |
virtual void | has_adopted (body_builder *obj) override |
inherited from body_builder More... | |
virtual void | will_foresake (body_builder *obj) override |
inherited from body_builder More... | |
void | reset_read_next () |
bool | read_next (bundle &bdl) const |
return false if bdl could not be set (nor more entry to read) | |
std::string | get_body_part_from_children_as_a_block (const chemin &path, const request &req) |
virtual std::string | inherited_get_body_part (const chemin &path, const request &req) override |
inherited from body_builder More... | |
![]() | |
virtual void | new_css_library_available () override |
inherited from body_builder More... | |
virtual void | has_adopted (body_builder *obj) |
inherited from body builder More... | |
std::string | get_tooltip_body_part () const |
![]() | |
virtual std::string | inherited_get_body_part (const chemin &path, const request &req)=0 |
implementation of get_body_part() method for inherited classes More... | |
void | my_body_part_has_changed () |
let a class record a change in what inherited_get_body_part() would return if it was called again with the same request More... | |
virtual void | my_visibility_has_changed () |
available for inherited class to be informed when their visibility changes More... | |
bool | has_my_body_part_changed () const |
obtain the body_part changed status More... | |
chemin | get_path () const |
return the path of 'this' according to its descent in the body_builder tree of adopted children | |
std::string | get_recorded_name () const |
void | store_css_library () |
this creates a css_library accessible from adopted objects to hold html class definitions More... | |
bool | has_local_css_library () const |
return true if this object has a css_library locally stored (not from a adopter object) | |
std::unique_ptr< css_library > & | lookup_css_library () const |
lookup toward registered parent body_builder object for the closest stored css_library More... | |
std::string | get_body_part_from_target_child (const chemin &path, const request &req) |
std::string | get_body_part_from_all_children (const chemin &path, const request &req) |
virtual void | path_has_changed () |
For inherited classes, called when the path has changed,. More... | |
virtual void | has_adopted (body_builder *obj) |
Be informed that a new child has been adopted. More... | |
virtual void | will_foresake (body_builder *obj) |
Be informed that a child is about to be foresaken. More... | |
virtual void | has_been_adopted_by (body_builder *obj) |
Be informed that we have been adopted by obj, our new parent. | |
virtual void | will_be_foresaken_by (body_builder *obj) |
Be informed that we are about to be foresaken by obj, our soon former parent. | |
virtual void | css_classes_have_changed () |
Be informed about css class modification. More... | |
virtual void | new_css_library_available () |
unsigned int | size () const |
access to adopted childs | |
body_builder * | operator[] (unsigned int i) |
access to adopted childs | |
body_builder * | get_parent () const |
return the parent object or nullptr if no object has adopted this object | |
template<class T > | |
void | closest_ancestor_of_type (T *&ancestor) |
access to the closest ancestor (parent) matching (dynamic_cast) the provided type More... | |
void | orphan_all_children () |
orphan all adopted children | |
bool | get_no_CR () const |
true if it has been requested no to add Carriage Return after the HTML object | |
![]() | |
virtual void | broken_peering_from (reference *obj) |
to be informed when a peer has broke the peering with me More... | |
void | reset_read_peers () const |
reset the peers reading | |
bool | read_next_peer (reference *&peer) const |
![]() | |
virtual void | broken_peering_from (reference *obj) override |
inherited from class reference More... | |
void | register_name (const std::string &name) |
add a new event for actors to register against | |
void | unregister_name (const std::string &name) |
remove an event and remove all actors that registed on it | |
void | rename_name (const std::string &old_name, const std::string &new_name) |
rename an event and keep all existing peering to this new event More... | |
void | act (const std::string &name) |
trigger a given event | |
Friends | |
class | html_form_dynamic_table::iterator |
Additional Inherited Members | |
![]() | |
static json | wrap_config_with_json_header (unsigned int version, const std::string &class_id, const json &config) |
given a version, class_id and configuration generates the global and common json structure More... | |
static json | unwrap_config_from_json_header (const json &source, unsigned int &version, std::string &class_id) |
from a given json global and common json structure split header parts and return the config part More... | |
![]() | |
static constexpr const char * | jsoner_version_label = "version" |
static constexpr const char * | jsoner_id_label = "class_id" |
static constexpr const char * | jsoner_config_label = "config" |
class html_form_dynamic_table web user dynamically add new lines in a table
The possible type of lines of the table are defined by the developper user of this class but this is the web user that defined the table content based on the available types
this html components is consitued of:
+----html_table-----------------------------+-------+ | | | | |+-----+|+-------------------------------+ |+-+ | ||label|||body_builder objet | || | del| |+-----+|+-------------------------------- |+-+ | |+-----+|+-------------------------------+ |+-+ | ||label|||body_builder objet | || | del| |+-----+|+-------------------------------- |+-+ | |+-----+|+-------------------------------+ |+-+ | ||label|||body_builder objet | || | del| |+-----+|+-------------------------------- |+-+ | |+-----+|+-------------------------------+ |+-+ | ||label|||body_builder objet | || | del| |+-----+|+-------------------------------- |+-+ | |+-----+|+-------------------------------+ |+-+ | ||label|||body_builder objet | || | del| |+-----+|+-------------------------------- |+-+ | +-------+-----------------------------------+-------+ +---------------------+ | add drop down list | (or html_button if only one type to add +---------------------+ (option to position the button before the table or after)
html_form_dynamic_table::html_form_dynamic_table | ( | bool | has_left_labels, |
bool | selector_below, | ||
const std::string & | adder_text, | ||
const std::string & | adder_default_choice | ||
) |
default event name for all object of this clas
constructor
has_left_labels | whether to display label on a left column |
selector_below | whether the selector is above or below the table |
adder_text | fixed label shown beside the add drop list |
adder_default_choice | default choice in the drop list |
void html_form_dynamic_table::add_line | ( | unsigned int | typenum | ) |
manually add an line in the table with the object type give in number
void html_form_dynamic_table::add_obj_type | ( | const std::string & | label | ) |
add a new object type to be proposed to the user from the "adder" selector
[in] | label | the column number for this object (starts at zero) |
|
overridevirtual |
inherited from jsoner
Implements jsoner.
|
overrideprotectedvirtual |
inherited methods from body_builder
Reimplemented from html_div.
|
overridevirtual |
inherited from jsoner
Implements jsoner.
|
overrideprotectedvirtual |
inherited from body_builder
Reimplemented from html_tooltip.
|
overridevirtual |
inherited from actor
Implements actor.
|
overridevirtual |
inherited from jsoner
Implements jsoner.
|
inline |
set context passed to the object provider
void html_form_dynamic_table::set_obj_type_provider | ( | const html_form_dynamic_table_object_provider * | provider | ) |
define a object provider
[in] | provider | the object provider. when needed by this dynamic table, the object provider will be asked to create a new object of type "num", the argument of html_form_dynamic_table_object_provider::provide_object_of_type() for num = 0 the object type provided by the first call to add_obj_type(), num = 1 correspond to the type of object which label has been provide by the second time add_obj_type() was called. before adding types of objects that will be proposed to the web user, an object provider (and only one) must be recorded calling this method |