|
Decision Center API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IlrScenarioSuiteKPIRenderer<T extends ilog.rules.dvs.common.output.IlrKPIResult>
Represents the KPI renderer.
Implement this interface to encode the KPI result.
This renderer is used when a test suite/simulation report is rendered.
By default, the predefined IlrKPIResult
classes have their associated renderers.
Define an implementation of IlrScenarioSuiteKPIRenderer
if you want the display
of the KPI to be different from the Decision Center classic display.
You then have to define, in Decision Center, a configuration parameter that associates the custom KPI to its renderer class.
The key is "teamserver." + kpiClassName + ".renderer"
.
For example, if the kpiClassName
is com.test.MyKPI
, the key must be
com.test.MyKPI.renderer
. The value is the fully qualified name of the KPI renderer.
Note: A custom KPI has an associated message. Define this message in a message.properties
file
and add it to the Decision Center application.
The following example shows an implementation of IlrScenarioSuiteKPIRenderer
that defines how
to view the KPI results in the Decision Center test suite/simulation report:
import ilog.rules.teamserver.web.components.renderers.IlrScenarioSuiteKPIRenderer; import java.io.IOException; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.context.ResponseWriter; public class ApprovedKPIRenderer implements IlrScenarioSuiteKPIRenderer{ // Method to write the html showing the KPI result. The result is written with a color depending on the value. public void encode(KPIResultInteger kpiResult, FacesContext context, UIComponent component) throws IOException { int percent = kpiResult.getValue(); String color = getColor(percent); ResponseWriter writer = context.getResponseWriter(); writer.startElement("div", component); writer.writeAttribute("style", "color:" + color, "style"); writer.write(kpiResult.getValue().toString() + "%"); writer.endElement("div"); } private String getColor(int percent) { if (percent < 20 ) return "red"; if (percent < 30) return "orange"; return "green"; } }
Decision Validation Services provides business rule testing and simulation solutions to developers and business users.
You use the DVS API to:
Method Summary | |
---|---|
void |
encode(T kpiResult,
javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Renders the specified IlrKPIResult . |
Method Detail |
---|
void encode(T kpiResult, javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws IOException
IlrKPIResult
.
IOException
- if an input/output error occurs.kpiResult
- The IlrKPIResult
to be rendered.context
- The FacesContext
for the request being processed.component
- The current UIComponent
.
|
Decision Center API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |