Decision Center API

ilog.rules.webui
Class IlrWSyntacticEditor

java.lang.Object
  extended by ilog.webui.dhtml.IlxWContainer
      extended by ilog.webui.dhtml.IlxWComponent
          extended by ilog.rules.webui.IlrWSyntacticEditor
All Implemented Interfaces:
ilog.webui.dhtml.IlxWConstants, ilog.webui.dhtml.IlxWCSSModelProvider, ilog.webui.dhtml.IlxWDependencyProvider, ilog.webui.dhtml.IlxWJSObject, 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

Nested Class Summary
 
Nested classes/interfaces inherited from class ilog.webui.dhtml.IlxWComponent
IlxWComponent.DynamicStyleMap
 
Field Summary
static String CSS_RESOURCE_NAME
          Resource path to the user-agent CSS.
 
Fields inherited from class ilog.webui.dhtml.IlxWContainer
listenerList
 
Constructor Summary
IlrWSyntacticEditor()
          Constructs a new Web Rule Editor.
 
Method Summary
 void addTokenStyle(Vector tokens, String styleName)
          Adds a style to a set of edited tokens.
 boolean canRedo()
          Specifies whether the redo action is possible.
 boolean canUndo()
          Specifies whether the 'undo' action is possible.
 void clearTokenStyles(String styleName)
          Removes a style from a set of edited tokens.
 void clearTokenStyles(Vector tokens, String styleName)
          Removes a style from a set of edited tokens.
 IlrWBRLSyntacticRuleElement getBRLRuleElement()
          Gets the rule currently edited by this rule editor.
 Locale getLocale()
          Gets the locale in which the current rule is edited.
 int getUndoLimit()
          Gets the undo limit.
protected  IlxWCSSRuleset getUserAgentRules()
          Gets the "user-agent" CSS rules.
 ilog.rules.brl.brldf.IlrBRLVariableProvider getVariableProvider()
          Gets the variable provider used, if any.
 boolean isAutoEditMode()
          Gets the automatic edit mode property.
 boolean isDHtml(IlxWPort port)
          Gets the value of the DHTML property.
 boolean isEditable()
          Returns the value of the Editable property.
protected  void make(IlxWPort port)
           
protected  void printComponent(IlxWPort port)
          Redefines the IlxWComponent.printComponent method.
 void redo()
          Redo action.
 void setApplication(String application)
          Deprecated.  
 void setAutoEditMode(boolean auto)
          Sets the automatic edit mode property.
 void setBRLRuleElement(ilog.rules.brl.IlrBRLRuleElement ruleElement, ilog.rules.vocabulary.model.IlrVocabulary vocabulary)
          Deprecated. Replaced by setBRLRuleElement(IlrWBRLSyntacticRuleElement, Locale)
 void setBRLRuleElement(IlrWBRLSyntacticRuleElement ruleElement, Locale locale)
          Sets the rule to be edited by this rule editor and the locale in which the element must be edited.
 void setDHtml(boolean dhtml)
          Sets the value of the DHTML property.
 void setEditable(boolean editable)
          Sets the Editable property.
 void setUndoLimit(int limit)
          Sets the undo limit.
 void setVariableProvider(ilog.rules.brl.brldf.IlrBRLVariableProvider variableProvider)
          Sets the variable provider to be used.
 void undo()
          Undo action.
 
Methods inherited from class ilog.webui.dhtml.IlxWComponent
addPropertyChangeListener, addPropertyChangeListener, detach, doPrint, firePropertyChange, firePropertyChange, getName, getRealHtmlTagName, getStyle, invalidate, isInvalidated, notifyDependencies, print, removePropertyChangeListener, removePropertyChangeListener, setName, validate
 
Methods inherited from class ilog.webui.dhtml.IlxWContainer
add, add, getAttribute, getAttributeNames, getComponent, getComponentCount, getComponentNamed, getComponents, getManager, getParent, indexOf, isAncestorOf, remove, remove, removeAll, removeAttribute, setAttribute, setAuthorRules, setFinalizer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CSS_RESOURCE_NAME

public static final 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.


printComponent

protected void printComponent(IlxWPort port)
                       throws IOException

Redefines the IlxWComponent.printComponent method.

Specified by:
printComponent in class IlxWComponent
Throws:
IOException
Parameters:
port - The port on which the component will be printed.
See Also:
IlxWComponent.print(ilog.webui.dhtml.IlxWPort)

addTokenStyle

public void addTokenStyle(Vector tokens,
                          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(Vector tokens,
                             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(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,
                              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 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)
Deprecated. Replaced by setBRLRuleElement(IlrWBRLSyntacticRuleElement, Locale)

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 IOException
Throws:
IOException

getUserAgentRules

protected IlxWCSSRuleset getUserAgentRules()
Description copied from class: IlxWContainer
Gets the "user-agent" CSS rules.
User agent rules are a set of CSS rules which will apply by default to each instance of this container. They may be completed or overridden by the author rules, set via the setAuthorRules method.

This method returns null by default but is intended to be redefined by subclasses.

Overrides:
getUserAgentRules in class IlxWContainer
Returns:
a CSS ruleset.
See Also:
IlxWContainer.setAuthorRules(ilog.webui.dhtml.IlxWCSSRuleset)

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.


setApplication

public void setApplication(String application)
Deprecated. 

If you are developing several applications with JRules, you need to call this method to specify the SAM application name that uses this particular instance of IlrWSyntacticEditor. It needs to be done before any call to the setTokenModel method.

If you do not know your SAM application name, run your application without setting the application name and look at the console output. You should see a warning message indicating that you have not set the SAM application name along with the list of the possible SAM application names. If you do not see the message, you probably only have one application and in this case, you do not need to set the SAM application name and you can ignore this method. For any further question, please contact ILOG Customer Support.

Note that an alternative way to set the SAM application name is to set the system property ilog.sam.application.

Parameters:
application - SAM application name of the application.

Decision Center API

© Copyright IBM Corp. 1987, 2013