ilog.rules.teamserver.web.components.property

Class IlrPropertyEditor

  • java.lang.Object
    • javax.faces.component.UIComponent
      • javax.faces.component.UIComponentBase
        • javax.faces.component.UICommand
          • ilog.rules.teamserver.web.components.property.IlrPropertyEditor
  • All Implemented Interfaces:
    ilog.rules.teamserver.web.components.property.PropertyEditor, java.io.Serializable, javax.faces.component.ActionSource, javax.faces.component.StateHolder


    public class IlrPropertyEditor
    extends javax.faces.component.UICommand
    implements ilog.rules.teamserver.web.components.property.PropertyEditor, java.io.Serializable
    IlrPropertyEditor is the base class for property editing in the Decision Center web client.

    Code example

    The following code example shows how to use IlrPropertyEditor:
       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();
         
           // Get the correct key of the property to set
           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();
           
           // Get the current string value of the property to be used in JavaScript
           // Be aware that editor.getValueString() returns the value ready to be shown in HTML
           String value = "";
           if (editor.getValue() != null)
             value = (editor.getValue()).toString();
           
           // Write HTML code with a JavaScript function to set the property value
           writer.write(...);
           ...
         }
       }  
     

    Note: this code example is taken from the Rule model extensions for Decision Center sample.

    See Also:
    Serialized Form
    • Property Summary

      Properties 
      Type Property and Description
      boolean isAggregated
      Checks if the property of this editor is aggregated.
    • Field Summary

      • Fields inherited from class javax.faces.component.UICommand

        COMPONENT_TYPE
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      IlrCommitableObject getCommitableObject() 
      IlxWComponent getComponent() 
      IlrCommitableObject getComposedElement()
      Gets the commitable object currently being edited.
      org.eclipse.emf.ecore.EClass getEClass() 
      org.eclipse.emf.ecore.EStructuralFeature getProperty()
      Returns the EMF property rendered by this editor.
      java.lang.String getPropertyName()
      Returns the name of the property.
      java.lang.Object getValue()
      Returns the value rendered by this editor.
      java.lang.String getValueString()
      Retrieves an HTML ready String for the value displayed by this editor.
      boolean isAggregatedProperty()
      Checks if the property of this editor is aggregated.
      boolean isPermissionGranted()
      Checks if the current user has the rights to edit an element.
      boolean isValueChanged() 
      void setCommitableObject(IlrCommitableObject commitableObject) 
      void setComponent(IlxWComponent component) 
      void setValue(java.lang.Object value)
      Sets the value to be rendered by this editor.
      void setValueChanged(boolean valueChanged) 
      • Methods inherited from class javax.faces.component.UICommand

        addActionListener, broadcast, getAction, getActionListener, getActionListeners, getFamily, isImmediate, queueEvent, removeActionListener, restoreState, saveState, setAction, setActionListener, setImmediate
      • Methods inherited from class javax.faces.component.UIComponentBase

        addFacesListener, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, isRendered, isTransient, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Property Detail

      • isAggregated

        Checks if the property of this editor is aggregated.
        Returns:
        This implementation always returns false.
    • Method Detail

      • isAggregatedProperty

        public boolean isAggregatedProperty()
        Checks if the property of this editor is aggregated.
        Returns:
        This implementation always returns false.
      • getEClass

        public org.eclipse.emf.ecore.EClass getEClass()
      • isValueChanged

        public boolean isValueChanged()
      • setValueChanged

        public void setValueChanged(boolean valueChanged)
      • getComposedElement

        public IlrCommitableObject getComposedElement()
        Description copied from interface: ilog.rules.teamserver.web.components.property.PropertyEditor
        Gets the commitable object currently being edited.

        This method will be used only when this component is in "editor" mode, meaning that it is embedded in an IlrUIElementDetailsEditor component.

        Specified by:
        getComposedElement in interface ilog.rules.teamserver.web.components.property.PropertyEditor
        Returns:
        A commitable object
      • getValueString

        public java.lang.String getValueString()
                                        throws IlrApplicationException
        Retrieves an HTML ready String for the value displayed by this editor.
        Throws:
        IlrApplicationException - if there is a problem on the server.
        Returns:
        An HTML ready String representing the value.
      • isPermissionGranted

        public boolean isPermissionGranted()
        Checks if the current user has the rights to edit an element. Property editor rendering is different if the current user does not have permission to edit the element.
        Specified by:
        isPermissionGranted in interface ilog.rules.teamserver.web.components.property.PropertyEditor
        Returns:
        If the user can edit the element, true is returned.
      • setValue

        public void setValue(java.lang.Object value)
        Sets the value to be rendered by this editor.
        Specified by:
        setValue in interface ilog.rules.teamserver.web.components.property.PropertyEditor
        Overrides:
        setValue in class javax.faces.component.UICommand
        Parameters:
        value - The value to render.
      • getProperty

        public org.eclipse.emf.ecore.EStructuralFeature getProperty()
        Returns the EMF property rendered by this editor.
        Specified by:
        getProperty in interface ilog.rules.teamserver.web.components.property.PropertyEditor
        Returns:
        The EMF property.
      • getPropertyName

        public java.lang.String getPropertyName()
        Returns the name of the property.
        Specified by:
        getPropertyName in interface ilog.rules.teamserver.web.components.property.PropertyEditor
        Returns:
        The property name.
      • getValue

        public java.lang.Object getValue()
        Returns the value rendered by this editor.
        Specified by:
        getValue in interface ilog.rules.teamserver.web.components.property.PropertyEditor
        Overrides:
        getValue in class javax.faces.component.UICommand
        Returns:
        The value rendered by this editor.
      • setComponent

        public void setComponent(IlxWComponent component)

© Copyright IBM Corp. 1987, 2017