ilog.rules.webui

Class IlrWSyntacticEditor

  • All Implemented Interfaces:
    ilog.webui.dhtml.IlxWConstants, ilog.webui.dhtml.IlxWCSSModelProvider, ilog.webui.dhtml.IlxWDependencyProvider, ilog.webui.dhtml.IlxWJSObject, java.io.Serializable


    public class IlrWSyntacticEditor
    extends IlxWComponent
    implements ilog.webui.dhtml.IlxWConstants
    IlrWSyntacticEditor

    Overview

    The Web Rule Editor can be integrated into your web application to provide business rule editAllMode capabilities.

    The Web Rule Editor is associated with a token model that represents the business rules to be edited.

    Code example

    The following code example shows you how to create and initialize a syntactic editor:

      private IlrWSyntacticEditor initializeSyntacticEditor(IlrSession rtsSession ,HttpSession session, IlrActionRule rule)
        throws IlrConnectException, IlrApplicationException, FileNotFoundException, IOException  {
        
          IlxWManager manager = IlxWManager.getManager(session);
          
          IlrWSyntacticEditor syntacticEditor;
          synchronized (manager) {
            syntacticEditor = (IlrWSyntacticEditor) manager.getComponentNamed(EDITORNAME);
            if (syntacticEditor == null) {
              syntacticEditor = new IlrWSyntacticEditor();
              syntacticEditor.setName(EDITORNAME);
              manager.add(syntacticEditor);
            }
            IlrWBRLSyntacticRuleElement ruleElement = getRuleElement(rtsSession, rule);
            syntacticEditor.setBRLRuleElement(ruleElement,rtsSession.getReferenceLocale());
            syntacticEditor.setAttribute(ACTION_RULE_UUID_ATTRIBUTE_NAME, rule.getUuid());
            syntacticEditor.setAuthorRules(new IlxWCSSRuleset(new InputStreamReader(RuleEditor.class.getClassLoader().getResourceAsStream("syntacticeditor.css") ))); //$NON-NLS-1$
          }
          return syntacticEditor;
      }
     
    See Also:
    IlrWBRLSyntacticRuleElement, IlrDTWTableComponent, Serialized Form
    • Field Detail

      • CSS_RESOURCE_NAME

        public static final java.lang.String CSS_RESOURCE_NAME
        Resource path to the user-agent CSS.
        See Also:
        Constant Field Values
    • Constructor Detail

      • IlrWSyntacticEditor

        public IlrWSyntacticEditor()

        Constructs a new Web Rule Editor.

    • Method Detail

      • setDHtml

        public void setDHtml(boolean dhtml)
        Sets the value of the DHTML property.

        When this property is true and the browser has DHTML capabilities, the editor is displayed with a smart user interface, using some advanced features of the DHTML capabilities provided by the Web browser. By default, this flag is true with IE5.x, and false with other Web browsers, like Netscape 3 or Netscape 4.

        If the browser does not support this mode, setting this flag has no effect.

        Parameters:
        dhtml - The new value of the DHTML property.
        See Also:
        isDHtml(ilog.webui.dhtml.IlxWPort)
      • isDHtml

        public boolean isDHtml(IlxWPort port)

        Gets the value of the DHTML property.

        Returns:
        true if the Web Rule Editor is in DHTML mode and the browser supports this mode; false otherwise.
        See Also:
        setDHtml(boolean)
      • isEditable

        public boolean isEditable()

        Returns the value of the Editable property.

      • setEditable

        public void setEditable(boolean editable)

        Sets the Editable property.

        This property manages the editAllMode mode. When true, the token model can be modified. When false, the editor is in read-only mode.

        The default value for this property is true.

      • addTokenStyle

        public void addTokenStyle(java.util.Vector tokens,
                         java.lang.String styleName)

        Adds a style to a set of edited tokens.

        Parameters:
        tokens - A Vector containing edited IlrToken objects.
        styleName - The name of a style defined in the current graphic resources.
        See Also:
        clearTokenStyles(Vector, String)
      • clearTokenStyles

        public void clearTokenStyles(java.util.Vector tokens,
                            java.lang.String styleName)

        Removes a style from a set of edited tokens.

        Parameters:
        tokens - A Vector containing edited IlrToken objects.
        styleName - The name of a style defined in the current graphic resources.
        See Also:
        addTokenStyle(Vector, String)
      • clearTokenStyles

        public void clearTokenStyles(java.lang.String styleName)

        Removes a style from a set of edited tokens.

        Parameters:
        styleName - The name of a style defined in the current graphic resources.
        See Also:
        addTokenStyle(Vector, String)
      • setBRLRuleElement

        public void setBRLRuleElement(IlrWBRLSyntacticRuleElement ruleElement,
                             java.util.Locale locale)
        Sets the rule to be edited by this rule editor and the locale in which the element must be edited.
        Parameters:
        ruleElement - The rule to be edited.
        locale - The locale in which the rule should be edited.
      • getBRLRuleElement

        public IlrWBRLSyntacticRuleElement getBRLRuleElement()
        Gets the rule currently edited by this rule editor.
        Returns:
        The edited rule.
      • getLocale

        public java.util.Locale getLocale()
        Gets the locale in which the current rule is edited.
        Returns:
        The locale in which the current rule is edited.
      • setBRLRuleElement

        public void setBRLRuleElement(ilog.rules.brl.IlrBRLRuleElement ruleElement,
                             ilog.rules.vocabulary.model.IlrVocabulary vocabulary)
        Sets the rule to be edited by this rule editor.
        Parameters:
        ruleElement - The rule to be edited.
      • setVariableProvider

        public void setVariableProvider(ilog.rules.brl.brldf.IlrBRLVariableProvider variableProvider)
        Sets the variable provider to be used.
        Parameters:
        variableProvider - The variable provider.
      • getVariableProvider

        public ilog.rules.brl.brldf.IlrBRLVariableProvider getVariableProvider()
        Gets the variable provider used, if any.
        Returns:
        The variable provider used, if any.
      • isAutoEditMode

        public boolean isAutoEditMode()

        Gets the automatic edit mode property.

        If this property is true and the dhtml property is false, the editAllMode mode of a line of the Web Rule Editor (editable or read-only) will be automatically computed. Otherwise it will be read-only by default, and editable if the user clicks on the "edit mode" icon at the end of the line.

        Returns:
        the value of the auto edit mode property.
      • setAutoEditMode

        public void setAutoEditMode(boolean auto)

        Sets the automatic edit mode property.

        See Also:
        isAutoEditMode()
      • make

        protected void make(IlxWPort port)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • setUndoLimit

        public void setUndoLimit(int limit)

        Sets the undo limit.

        By default the undo limit is set to 100.

        Parameters:
        limit - The new undo limit (an integer greater or equal to 0).
        See Also:
        getUndoLimit()
      • getUndoLimit

        public int getUndoLimit()

        Gets the undo limit.

        Returns:
        the undo limit.
        See Also:
        setUndoLimit(int)
      • undo

        public void undo()
        Undo action.

        If the undo is not possible, this method has no effect.

      • canUndo

        public boolean canUndo()

        Specifies whether the 'undo' action is possible.

      • redo

        public void redo()
        Redo action.

        If the redo is not possible, this method has no effect.

      • canRedo

        public boolean canRedo()

        Specifies whether the redo action is possible.

© Copyright IBM Corp. 1987, 2015