1 package okw.log.log2html;
3 import org.apache.commons.text.StringEscapeUtils;
10 private String type =
"Function";
11 private String functionName;
12 private String[] parameter;
19 functionName = fpsFunctionName;
20 parameter = fpsParameter;
25 StringBuilder StrBuilder =
new StringBuilder();
27 StrBuilder.append(fpsFunctionName +
"( " );
29 Boolean GreaterOne =
false;
30 for ( String sParameter : fpsParameter )
32 if (GreaterOne) StrBuilder.append(
", " );
33 else GreaterOne =
true;
35 StrBuilder.append( sParameter );
38 StrBuilder.append(
" )" );
40 this.Info = StrBuilder.toString();
43 public void setReturn(String fpsReturn)
49 protected String getHTMLResult()
51 StringBuilder sbResult =
new StringBuilder();
53 String lvsIndention = this.getLevelIndention();
57 sbResult.append( lvsIndention +
"<div class='" + this.getClass().getSimpleName() +
"'>\n" );
58 sbResult.append( lvsIndention + myIndentionBase +
"<div class='Header'>\n" );
60 if (!this.myLogs.isEmpty())
62 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div class='FoldMe' onClick='div_change(" + myID.toString() +
")'></div>\n" );
65 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div class='Duration'>" + this.myDuration.getSeconds(
"#0.000") +
" s</div>" );
70 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div class='ExceptionSign' title='Exception...'></div>\n" );
76 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div class='ErrorSign' title='Error...'></div>\n" );
81 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div class='WarningSign' title='Warning...'></div>\n" );
84 if (this.bException || this.bError )
86 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div class='Info_Fail'>" + StringEscapeUtils.escapeHtml4(
this.Info) +
"</div>\n" );
90 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div class='SuccessSign' title='Success...'></div>\n" );
91 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div class='Info_Pass'>" + StringEscapeUtils.escapeHtml4(
this.Info) +
"</div>\n" );
94 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"</div>\n" );
97 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div class='Body' id='" + myID.toString() +
"' style='display: none;'>\n" );
99 for(
LogBase myLog: this.myLogs )
101 sbResult.append( myLog.getHTMLResult() );
104 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div>Return: "+ StringEscapeUtils.escapeHtml4(
this.myReturn) +
"</div>\n" );
106 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"</div>\n" );
108 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"</div>\n" );
111 return sbResult.toString();
116 protected void ErrorCount()
124 if ( myParent !=
null)
126 myParent.ErrorCount();
132 protected void ExceptionCount()
138 this.bException =
true;
140 if ( myParent !=
null)
142 myParent.ExceptionCount();
147 protected void FunctionFail()
149 if ( ! (this.bError || this.bException ) )
150 myParent.FunctionFail();
155 protected String getJSONNodeProperties()
157 StringBuilder myJSON =
new StringBuilder();
159 myJSON.append( this.jsonElementComma(
"type", this.type ) );
161 myJSON.append( this.jsonElementComma(
"Info", this.Info ) );
164 myJSON.append( this.jsonElementComma(
"Function", this.functionName ) );
166 for ( Integer i = 0; i < this.parameter.length; i++) {
168 myJSON.append( this.jsonElementComma(
"Parameter" + i.toString(), parameter[i] ) );
171 return myJSON.toString();