Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
HtmlTable.cxx
1/*
2 * HalHtmlTable.cxx
3 *
4 * Created on: 8 paź 2020
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9#include "HtmlTable.h"
10
11#include <TString.h>
12#include <iostream>
13namespace Hal {
14 HtmlTable::HtmlTable() {}
15
16 HtmlTable::HtmlTable(TString id, TString className, TString style) : HtmlObject(id, className, style) {}
17 void HtmlTable::AddContent(const HtmlObject& obj) {
18 if (obj.InheritsFrom("Hal::HtmlRow")) { HtmlObject::AddContent(obj); }
19 }
20
21 HtmlTable::~HtmlTable() {}
22
23 TString HtmlTable::ToString() const { return GetDefaultString("table"); }
24
25 HtmlRow::HtmlRow() {}
26
27 HtmlRow::HtmlRow(TString id, TString className, TString style) : HtmlObject(id, className, style) {}
28
30 if (obj.InheritsFrom("Hal::HtmlCell")) { HtmlObject::AddContent(obj); }
31 }
32
33 TString HtmlRow::ToString() const { return GetDefaultString("tr"); }
34
35 HtmlRow::~HtmlRow() {}
36
37 HtmlCell::HtmlCell() : fColSpan(0), fRowSpan(0) {}
38
40
41 TString HtmlCell::ToString() const {
42 TString res = "<td";
43 res = res + GetProperties();
44 if (fColSpan > 0) {
45 res = res + Form(" colspan=\"%i\">", fColSpan);
46 } else if (fRowSpan > 0) {
47 res = res + Form(" rowspan=\"%i\">", fRowSpan);
48 } else {
49 res = res + ">";
50 }
51 res = res + GetContent();
52 return res + "</td>";
53 }
54
55 HtmlCell::~HtmlCell() {}
56
57 HtmlCell::HtmlCell(TString content) : HtmlCell() { SetStringContent(content); }
58
59 HtmlCell::HtmlCell(TString id, TString className, TString style) : HtmlObject(id, className, style), fColSpan(0), fRowSpan(0) {}
60
61 HtmlCellCol::HtmlCellCol() {}
62
63 HtmlCellCol::HtmlCellCol(TString name, Int_t colspan) : HtmlCell(name) { SetColSpan(colspan); }
64
65 HtmlCellCol::~HtmlCellCol() {}
66
67 HtmlCellRow::HtmlCellRow() {}
68
69 HtmlCellRow::HtmlCellRow(TString name, Int_t colspan) : HtmlCell(name) { SetRowSpan(colspan); }
70
71 HtmlCellRow::~HtmlCellRow() {}
72
73 namespace HtmlTableRowClass {
74 TString LightBlue() { return "light_blue"; }
75 TString MedBlue() { return "med_blue"; }
76 TString DarkBlue() { return "dark_blue"; }
77 TString LightGreen() { return "green_"; }
78 TString Green() { return "med_green"; } // not exist!
79 TString DarkGreen() { return "dark_green"; }
80 TString Yellow() { return "yellow_"; }
81 TString Grey() { return "grey_"; }
82 TString Red() { return "red_"; }
83 TString Violet() { return "violet_"; }
84
85 TString DefStyle() { return LightBlue(); }
86 TString LegendStyle() { return LightGreen(); }
87 TString TitleStyle() { return DarkBlue(); }
88 TString ExtraStyle() { return MedBlue(); }
89 TString TaskStyle() { return Red(); }
90 TString ExpandableStyle() { return Yellow(); }
91 TString SummaryStyle() { return Violet(); }
92 } // namespace HtmlTableRowClass
93
94 void HtmlRow::AddSimpleCells(std::initializer_list<TString> cels) {
95 for (auto str : cels) {
96 this->AddContent(HtmlCell(str));
97 }
98 }
99
100} // namespace Hal
TString ToString() const
Definition HtmlTable.cxx:41
virtual void AddContent(const HtmlObject &obj)
Definition HtmlTable.cxx:39
TString GetDefaultString(TString tag) const
virtual void AddContent(const HtmlObject &obj)
TString ToString() const
Definition HtmlTable.cxx:33
virtual void AddContent(const HtmlObject &obj)
Definition HtmlTable.cxx:29