UI-Base: diagnostic self-ID for any "tangible" UI-Element

low hanging fruit, and quite helpful e.g. when a Diff flounders,
since it will automatically show up in the exception message.
This commit is contained in:
Fischlurch 2020-02-22 18:06:51 +01:00
parent b2b5cf0f6d
commit 14b6a1e6aa
3 changed files with 97 additions and 39 deletions

View file

@ -35,6 +35,7 @@
#include "stage/model/controller.hpp"
#include "include/ui-protocol.hpp"
#include "lib/diff/gen-node.hpp"
#include "lib/meta/util.hpp"
namespace stage {
@ -46,6 +47,18 @@ namespace model {
/** diagnostic representation.
* @note used in exceptions to indicate the origin.
*/
Tangible::operator string() const
{
return lib::meta::typeStr (this)
+ "("
+ string{this->getID()}
+ ")";
}
/** invoke the generic reset hook
* @note the actual subclass has to override the doReset() hook
* to perform the actual clean-up work.
@ -59,10 +72,10 @@ namespace model {
*/
void
Tangible::reset()
{
if (this->doReset())
uiBus_.note (GenNode{string{MARK_reset}, true});
}
{
if (this->doReset())
uiBus_.note (GenNode{string{MARK_reset}, true});
}
/** invoke the hook to clear error markers
@ -81,10 +94,10 @@ namespace model {
*/
void
Tangible::clearErr()
{
if (this->doClearErr())
uiBus_.note (GenNode{string{MARK_clearErr}, true});
}
{
if (this->doClearErr())
uiBus_.note (GenNode{string{MARK_clearErr}, true});
}
/** invoke the hook to clear notification messages
@ -92,10 +105,10 @@ namespace model {
*/
void
Tangible::clearMsg()
{
if (this->doClearMsg())
uiBus_.note (GenNode{string{MARK_clearMsg}, true});
}
{
if (this->doClearMsg())
uiBus_.note (GenNode{string{MARK_clearMsg}, true});
}
/** highlight the element visually to catch the user's attention
@ -104,9 +117,9 @@ namespace model {
*/
void
Tangible::markFlash()
{
this->doFlash();
}
{
this->doFlash();
}
/** push a notification (or warning) message to the element.
@ -124,10 +137,10 @@ namespace model {
*/
void
Tangible::markMsg (string message)
{
if (this->doMsg (message))
uiBus_.note (GenNode{string{MARK_Message}, message});
}
{
if (this->doMsg (message))
uiBus_.note (GenNode{string{MARK_Message}, message});
}
/** push an error state tag to the element
@ -135,10 +148,10 @@ namespace model {
*/
void
Tangible::markErr (string error)
{
if (this->doErr (error))
uiBus_.note (GenNode{string{MARK_Error}, error});
}
{
if (this->doErr (error))
uiBus_.note (GenNode{string{MARK_Error}, error});
}
/**
@ -156,7 +169,7 @@ namespace model {
void
Tangible::slotExpand()
{
if (this->doExpand(true))
if (this->doExpand (true))
uiBus_.note (GenNode{string{MARK_expand}, true});
}
@ -168,7 +181,7 @@ namespace model {
void
Tangible::slotCollapse()
{
if (this->doExpand(false))
if (this->doExpand (false))
uiBus_.note (GenNode{string{MARK_expand}, false});
}

View file

@ -189,8 +189,11 @@ namespace model {
public:
virtual ~Tangible(); ///< this is an interface
operator ID() const { return uiBus_.getID();}
operator LuidH() const { return uiBus_.getID().getHash(); }
operator ID() const { return uiBus_.getID();}
operator LuidH() const { return uiBus_.getID().getHash(); }
operator string() const;
ID getID() const { return uiBus_.getID();}
void reset();
void clearMsg();

View file

@ -28992,7 +28992,7 @@
<node CREATED="1448070559466" ID="ID_182430638" MODIFIED="1557498707235" TEXT="Controller"/>
</node>
<node CREATED="1448070583679" HGAP="69" ID="ID_1248152908" MODIFIED="1557498707235" TEXT="Protokoll" VSHIFT="-1">
<node CREATED="1448078263344" ID="ID_1136748666" MODIFIED="1561827465333" TEXT="Verhaltensweisen">
<node CREATED="1448078263344" FOLDED="true" ID="ID_1136748666" MODIFIED="1582388511425" TEXT="Verhaltensweisen">
<cloud COLOR="#e0d6ba"/>
<icon BUILTIN="info"/>
<node CREATED="1448078268223" ID="ID_1027574047" MODIFIED="1518487921085" TEXT="Lebenszyklus">
@ -29153,9 +29153,10 @@
</node>
</node>
</node>
<node CREATED="1448658633478" HGAP="99" ID="ID_314439240" MODIFIED="1561827465349" TEXT="Design" VSHIFT="13">
<node CREATED="1448658633478" HGAP="99" ID="ID_314439240" MODIFIED="1582388681066" TEXT="Design" VSHIFT="13">
<font NAME="SansSerif" SIZE="13"/>
<icon BUILTIN="button_ok"/>
<node CREATED="1448658692023" ID="ID_339186676" MODIFIED="1576282358014">
<node CREATED="1448658692023" FOLDED="true" ID="ID_339186676" MODIFIED="1582388523994">
<richcontent TYPE="NODE"><html>
<head>
@ -29369,7 +29370,7 @@
</node>
</node>
</node>
<node CREATED="1535639028984" ID="ID_316446199" MODIFIED="1561827465354" TEXT="hilfs-Abstraktionen">
<node CREATED="1535639028984" FOLDED="true" ID="ID_316446199" MODIFIED="1582388552498" TEXT="hilfs-Abstraktionen">
<linktarget COLOR="#709eaf" DESTINATION="ID_316446199" ENDARROW="Default" ENDINCLINATION="-354;-490;" ID="Arrow_ID_1105268233" SOURCE="ID_447101734" STARTARROW="None" STARTINCLINATION="-3385;0;"/>
<node CREATED="1535639151330" ID="ID_301022990" MODIFIED="1535639159958" TEXT="mix-in">
<icon BUILTIN="yes"/>
@ -29427,7 +29428,7 @@
<node CREATED="1535639517897" ID="ID_1175119585" MODIFIED="1535725607419" TEXT="Funktions-Operator(void) == reveal"/>
<node CREATED="1535640911061" ID="ID_777387548" MODIFIED="1535725678665" TEXT="reveal(canvasX,canvasY) auf dem Layout-Manager"/>
</node>
<node CREATED="1535640932722" ID="ID_1411372901" MODIFIED="1561827465354" TEXT="NavScope">
<node CREATED="1535640932722" FOLDED="true" ID="ID_1411372901" MODIFIED="1582388541734" TEXT="NavScope">
<icon BUILTIN="button_cancel"/>
<icon BUILTIN="hourglass"/>
<node CREATED="1535654864507" ID="ID_976171939" MODIFIED="1535654872624" TEXT="erst mal nur so eine Idee....">
@ -29465,7 +29466,7 @@
<icon BUILTIN="yes"/>
</node>
</node>
<node CREATED="1535655039395" ID="ID_1646511082" MODIFIED="1561827465361" TEXT="Diskussion">
<node CREATED="1535655039395" FOLDED="true" ID="ID_1646511082" MODIFIED="1582388543675" TEXT="Diskussion">
<icon BUILTIN="button_ok"/>
<node CREATED="1535655065175" ID="ID_702941818" MODIFIED="1535655069235" TEXT="Symmetrie?">
<node CREATED="1535655118800" ID="ID_1058761508" MODIFIED="1535655127308" TEXT="Expander ist nur pro Komponente">
@ -29565,7 +29566,7 @@
</node>
</node>
</node>
<node COLOR="#338800" CREATED="1535722960729" ID="ID_303674498" MODIFIED="1561827465367" TEXT="Abw&#xe4;gung">
<node COLOR="#338800" CREATED="1535722960729" FOLDED="true" ID="ID_303674498" MODIFIED="1582388548725" TEXT="Abw&#xe4;gung">
<icon BUILTIN="yes"/>
<node BACKGROUND_COLOR="#ccb59b" COLOR="#6e2a38" CREATED="1535723619257" ID="ID_1146060205" MODIFIED="1535723638348" TEXT="Ich folge dem appeal der Funktor-L&#xf6;sung">
<font ITALIC="true" NAME="SansSerif" SIZE="14"/>
@ -31455,7 +31456,7 @@
<icon BUILTIN="idea"/>
</node>
</node>
<node CREATED="1448658819990" ID="ID_405705528" MODIFIED="1561827465615" TEXT="API explizit">
<node CREATED="1448658819990" FOLDED="true" ID="ID_405705528" MODIFIED="1582388565907" TEXT="API explizit">
<icon BUILTIN="help"/>
<node CREATED="1448658861760" ID="ID_1373851015" MODIFIED="1518487921087" TEXT="pro">
<node CREATED="1448658867680" ID="ID_766147415" MODIFIED="1518487921087" TEXT="sauber"/>
@ -31471,7 +31472,7 @@
<node CREATED="1448683674443" ID="ID_1931753413" MODIFIED="1518487921087" TEXT="Einheitlichkeit gef&#xe4;hrdet"/>
</node>
</node>
<node CREATED="1448683454504" HGAP="42" ID="ID_510876193" MODIFIED="1518487921087" TEXT="API generisch" VSHIFT="-1">
<node CREATED="1448683454504" FOLDED="true" HGAP="42" ID="ID_510876193" MODIFIED="1582388564341" TEXT="API generisch" VSHIFT="-1">
<icon BUILTIN="button_ok"/>
<node CREATED="1448683636672" ID="ID_1485949406" MODIFIED="1518487921087" TEXT="verhindert Wildwuchs"/>
<node CREATED="1448683475853" ID="ID_24599710" MODIFIED="1518487921087">
@ -31504,7 +31505,7 @@
<icon BUILTIN="help"/>
</node>
</node>
<node CREATED="1448691264512" ID="ID_1193936433" MODIFIED="1512926192187" TEXT="InvocationTrail erstellen">
<node CREATED="1448691264512" FOLDED="true" ID="ID_1193936433" MODIFIED="1582388577398" TEXT="InvocationTrail erstellen">
<icon BUILTIN="button_cancel"/>
<node CREATED="1450490467952" ID="ID_1453525628" MODIFIED="1450490480705" TEXT="verwendet zwei GenNode-bindings"/>
<node CREATED="1450490481270" ID="ID_1603770702" MODIFIED="1576282358007" TEXT="fertig implementiert">
@ -31546,7 +31547,7 @@
<icon BUILTIN="yes"/>
</node>
</node>
<node CREATED="1448691315849" ID="ID_1198560195" MODIFIED="1492442332396" TEXT="Bindugs-Regel">
<node CREATED="1448691315849" FOLDED="true" ID="ID_1198560195" MODIFIED="1582388582841" TEXT="Bindugs-Regel">
<icon BUILTIN="hourglass"/>
<node CREATED="1448691343406" ID="ID_642235825" MODIFIED="1448691350558" TEXT="funktor"/>
<node CREATED="1448691324304" ID="ID_1103199702" MODIFIED="1448691338522" TEXT="definiert Bezugs-Quellen"/>
@ -31605,6 +31606,31 @@
</node>
</node>
</node>
<node CREATED="1582388591087" HGAP="65" ID="ID_457412600" MODIFIED="1582388675571" TEXT="Technik" VSHIFT="41">
<font NAME="SansSerif" SIZE="14"/>
<node CREATED="1582388650742" ID="ID_681444782" MODIFIED="1582388698969">
<richcontent TYPE="NODE"><html>
<head>
</head>
<body>
<p>
&#187;<b>Tangible</b>&#171; : Basis
</p>
</body>
</html>
</richcontent>
<font NAME="SansSerif" SIZE="13"/>
<node CREATED="1582388710734" ID="ID_763140844" MODIFIED="1582388714337" TEXT="Komponenten"/>
<node CREATED="1582388714901" ID="ID_1965183860" MODIFIED="1582388717017" TEXT="Funktionen">
<node CREATED="1582388720805" ID="ID_1679585515" MODIFIED="1582388727816" TEXT="Diagnostik">
<node COLOR="#338800" CREATED="1582388728476" ID="ID_1154344311" MODIFIED="1582390885990" TEXT="operator string: Typ und ID">
<icon BUILTIN="button_ok"/>
</node>
</node>
</node>
</node>
</node>
</node>
<node CREATED="1448669332204" HGAP="76" ID="ID_329609486" MODIFIED="1566955621429" TEXT="InteractionControl">
<arrowlink COLOR="#b694bf" DESTINATION="ID_430949603" ENDARROW="Default" ENDINCLINATION="178;425;" ID="Arrow_ID_1062305149" STARTARROW="Default" STARTINCLINATION="-629;-2354;"/>
@ -37620,7 +37646,7 @@
<icon BUILTIN="flag"/>
</node>
</node>
<node CREATED="1576202545211" FOLDED="true" ID="ID_862025814" MODIFIED="1576281725292" TEXT="Diff-Bindung">
<node CREATED="1576202545211" ID="ID_862025814" MODIFIED="1582387512534" TEXT="Diff-Bindung">
<font NAME="SansSerif" SIZE="14"/>
<icon BUILTIN="forward"/>
<node CREATED="1576202990623" ID="ID_1903460265" MODIFIED="1576203228840" TEXT="konkret entwickelt f&#xfc;r das UI-Element">
@ -41394,6 +41420,22 @@
</node>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1582387518143" ID="ID_1511785718" MODIFIED="1582387563106" TEXT="Aufspiel-Fehler beim 2.Timeline-Diff">
<icon BUILTIN="flag-yellow"/>
<node CREATED="1582387575560" ID="ID_1823810514" MODIFIED="1582387638910" TEXT="Reihenfolge egal">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<body>
<p>
es ist wohl nicht ein spezieller Diff. Es tritt sogar auf, wenn man zweimal den gleichen Diff schickt
</p>
</body>
</html>
</richcontent>
</node>
</node>
</node>
</node>
<node CREATED="1502452581379" FOLDED="true" HGAP="3" ID="ID_1651893758" MODIFIED="1576281567403" TEXT="Darstellung" VSHIFT="31">