|
Decision Center API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.faces.render.Renderer ilog.rules.webc.jsf.renderers.IlrBaseRenderer ilog.rules.teamserver.web.components.property.renderers.IlrPropertyEditorRenderer
public class IlrPropertyEditorRenderer
IlrPropertyEditorRenderer
is the base class for rendering the
HTML representation of a property in the Decision Center web client.
You can define custom property editors to be used in the Compose Wizard. You access this wizard from the Decision Center Compose tab.
To define a custom renderer:
You can customize the rule model extension files (.brmx and .brdx) directly in the XML files, or in the Rule Designer Rule Model Extension Editor. You can provide annotations that are specific to Decision Center in these extension files.
The following code example shows a custom rendering class implementation:
public class CustomRequirementPropertyRenderer extends IlrPropertyEditorRenderer { private static final long serialVersionUID = 1L; private static Logger log = Logger.getLogger(CustomRequirementPropertyRenderer.class.getName()); public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException { } public void encodeChildren(FacesContext context, UIComponent component) throws IOException { } public void encodeValueField(FacesContext context, UIComponent component, boolean checkPermission) throws IOException, IlrApplicationException { log.log(Level.WARNING, "Start encodeValueField"); IlrPropertyEditor editor = (IlrPropertyEditor) component; if (checkPermission && !editor.isPermissionGranted()) super.encodeValueField(context, component, checkPermission); else { ResponseWriter writer = context.getResponseWriter(); EStructuralFeature p = editor.getProperty(); String key = component.getParent().getClientId(context) + "_" + //work around a jsf bug : sometimes 2 different components get the same generated id. component.getClientId(context) + "_" + p.getName(); writer.write(\"<select name=\" + key + "\">\n"); Object value = editor.getValue(); ListpossibleValues = CustomDataProvider.getRequirements(); for (int i = 0; i < possibleValues.size(); i++) { String s = (String) possibleValues.get(i); writer.write("<option"); if (s.equals(value)) writer.write(" selected"); writer.write(" value=\"" + s + "\">\n"); writer.write(" " + s); writer.write("</option>\n"); } writer.write("</select>\n"); } } static class CustomDataProvider { static public List getRequirements() { ArrayList list = new ArrayList (); list.add("Requirement 1"); list.add("Requirement 2"); list.add("Requirement 3"); return list; } } }
The following example shows the configuration to be added to the configuration file in order to add the extended renderer to Decision Center.
<render-kit> <renderer> <component-family>IlrPropertyEditor</component-family> <renderer-type>CustomRequirementPropertyRenderer</renderer-type> <renderer-class>serverextendedbrm.CustomRequirementPropertyRenderer</renderer-class> </renderer> </render-kit>
Note: these code examples are taken from the Rule model extensions for Decision Center sample.
Field Summary | |
---|---|
protected String |
ComplexExpression
|
static String |
EMPTY_VALUE_NOT_VALID
|
static String |
INVALID_CHARACTER
|
static String |
INVALID_VALUE
|
Constructor Summary | |
---|---|
IlrPropertyEditorRenderer()
|
Method Summary | |
---|---|
Object |
convert(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String value)
|
protected IlxWTextField |
createTextField(IlrPropertyEditor editor,
javax.faces.context.FacesContext context)
|
void |
decode(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
This JSF method decodes a component. |
void |
encodeAsEditor(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Encodes the component in editing mode. |
void |
encodeAsQueryEditor(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Encodes the component in query mode. |
void |
encodeAsViewer(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component)
Encodes the component in viewing mode. |
void |
encodeBegin(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component)
Encodes the beginning of the component. |
void |
encodeChildren(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component)
Encodes the children of a component. |
void |
encodeEnd(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Encodes the end of the component. |
protected void |
encodeValue(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component)
Encodes the value of the property. |
void |
encodeValueField(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
boolean checkPermission)
Encodes the value field. |
protected String |
getId(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
org.eclipse.emf.ecore.EStructuralFeature property)
The value returned by getId is used in
encodeValueField(FacesContext, UIComponent, boolean)
to encode the input HTML tag that will hold the property value. |
protected String |
getValue(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
org.eclipse.emf.ecore.EStructuralFeature property)
Override this method to return the new value for the element property. |
protected Object |
throwEmptyValueError(org.eclipse.emf.ecore.EStructuralFeature feature)
|
protected Object |
throwInvalidCharacterError(org.eclipse.emf.ecore.EStructuralFeature feature,
String value,
ilog.rules.res.model.IlrFormatException e)
|
protected Object |
throwInvalidValueError(org.eclipse.emf.ecore.EStructuralFeature feature,
String value)
|
Methods inherited from class ilog.rules.webc.jsf.renderers.IlrBaseRenderer |
---|
convertClientId, displayButton, displayButton, encodeRecursive, getImagesDir, getImagesLocation, getMyForm |
Methods inherited from class javax.faces.render.Renderer |
---|
getConvertedValue, getRendersChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String INVALID_VALUE
public static final String EMPTY_VALUE_NOT_VALID
public static final String INVALID_CHARACTER
protected String ComplexExpression
Constructor Detail |
---|
public IlrPropertyEditorRenderer()
Method Detail |
---|
public void decode(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
Do not to override this method, override
getValue(javax.faces.context.FacesContext, javax.faces.component.UIComponent, org.eclipse.emf.ecore.EStructuralFeature)
instead.
This method is called in the default implementation of
decode
to set the value on an element.
decode
in class javax.faces.render.Renderer
context
- The component.component
- The context.protected String getValue(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, org.eclipse.emf.ecore.EStructuralFeature property)
This method is used in
decode(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
.
This default implementation returns the value stored in the request
parameter map for the key:
component.getParent().getClientId(context) + "_" + component.getClientId(context) + "_" + property.getName()See the JSF documentation for more information.
context
- The context.component
- The component.property
- The property.
public Object convert(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value) throws IllegalArgumentException
IllegalArgumentException
protected Object throwEmptyValueError(org.eclipse.emf.ecore.EStructuralFeature feature)
protected Object throwInvalidValueError(org.eclipse.emf.ecore.EStructuralFeature feature, String value)
protected Object throwInvalidCharacterError(org.eclipse.emf.ecore.EStructuralFeature feature, String value, ilog.rules.res.model.IlrFormatException e)
protected String getId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, org.eclipse.emf.ecore.EStructuralFeature property)
getId
is used in
encodeValueField(FacesContext, UIComponent, boolean)
to encode the input HTML tag that will hold the property value.
This value is then used in
getValue(FacesContext, UIComponent, EStructuralFeature)
to retrieve the value of this property.
context
- The context.component
- The component.property
- The property.public void encodeBegin(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component) throws IOException
encodeBegin
in class javax.faces.render.Renderer
IOException
- if there is a problem writing to a stream.facesContext
- The context.component
- The component.public void encodeChildren(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component) throws IOException
encodeChildren
in class javax.faces.render.Renderer
IOException
- if there is a problem writing to a stream.facesContext
- The context.component
- The component.public void encodeEnd(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws IOException
encodeEnd
in class javax.faces.render.Renderer
IOException
- if there is a problem writing to a stream.context
- The context.component
- The component.public void encodeAsViewer(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component) throws IOException, IlrApplicationException
IOException
- if there is a problem writing to a stream.
IlrApplicationException
- if there is a business exception on
the server.facesContext
- The context to use.component
- The component.protected void encodeValue(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component) throws IOException, IlrApplicationException
encodeAsViewer(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
.
IOException
IlrApplicationException
facesContext
- component
- public void encodeAsEditor(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws IOException, IlrApplicationException
IOException
IlrApplicationException
context
- component
- public void encodeValueField(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, boolean checkPermission) throws IOException, IlrApplicationException
encodeAsEditor(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
.
IOException
IlrApplicationException
context
- component
- checkPermission
- public void encodeAsQueryEditor(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws IOException, IlrApplicationException
IOException
IlrApplicationException
context
- component
- protected IlxWTextField createTextField(IlrPropertyEditor editor, javax.faces.context.FacesContext context)
|
Decision Center API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |