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 )
34 StrBuilder.append(
", " );
41 StrBuilder.append( sParameter );
44 StrBuilder.append(
")" );
46 this.Info = StrBuilder.toString();
49 public void setReturn( String fpsReturn )
54 protected void SetFail()
57 if ( !( this.bError || this.bException ) )
63 protected void SetPass()
69 protected String getHTMLResult()
71 StringBuilder sbResult =
new StringBuilder();
73 String lvsIndention = this.getLevelIndention();
77 sbResult.append( lvsIndention +
"<div class='" + this.getClass().getSimpleName() +
"'>\n" );
78 sbResult.append( lvsIndention + myIndentionBase +
"<div class='Header'>\n" );
80 if ( !this.myLogs.isEmpty() )
82 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div class='FoldMe' onClick='div_change(" + myID.toString()
86 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div class='Duration'>" + this.myDuration.getSeconds(
"#0.000" ) +
" s</div>" );
89 if ( this.bException )
91 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div class='ExceptionSign' title='Exception...'></div>\n" );
97 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div class='ErrorSign' title='Error...'></div>\n" );
102 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div class='WarningSign' title='Warning...'></div>\n" );
105 if ( this.bException || this.bError )
107 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div class='Info_Fail'>" + StringEscapeUtils.escapeHtml4(
this.Info) +
"</div>\n" );
111 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div class='SuccessSign' title='Success...'></div>\n" );
112 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div class='Info_Pass'>" + StringEscapeUtils.escapeHtml4(
this.Info) +
"</div>\n" );
115 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"</div>\n" );
117 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div class='Body' id='" + myID.toString() +
"' style='display: none;'>\n" );
119 for (
LogBase myLog : this.myLogs )
121 sbResult.append( myLog.getHTMLResult() );
124 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"<div>Return: " + StringEscapeUtils.escapeHtml4(
this.myReturn) +
"</div>\n" );
126 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"</div>\n" );
128 sbResult.append( lvsIndention + myIndentionBase + myIndentionBase +
"</div>\n" );
131 return sbResult.toString();
135 protected void ErrorCount()
143 if ( myParent !=
null )
145 myParent.ErrorCount();
150 protected void ExceptionCount()
156 this.bException =
true;
158 if ( myParent !=
null )
160 myParent.ExceptionCount();
165 protected void FunctionFail()
167 if ( !( this.bError || this.bException ) )
168 myParent.FunctionFail();
172 protected String getJSONNodeProperties()
174 StringBuilder myJSON =
new StringBuilder();
176 myJSON.append( this.jsonElementComma(
"type", this.type ) );
178 myJSON.append( this.jsonElementComma(
"Info", this.Info ) );
180 myJSON.append( this.jsonElementComma(
"Function", this.functionName ) );
182 for ( Integer i = 0; i < this.parameter.length; i++ )
185 myJSON.append( this.jsonElementComma(
"Parameter" + i.toString(), parameter[i] ) );
188 return myJSON.toString();