Class IlrWSyntacticEditor
- java.lang.Object
-
- ilog.webui.dhtml.IlxWContainer
-
- ilog.webui.dhtml.IlxWComponent
-
- ilog.rules.webui.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; }
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ilog.webui.dhtml.IlxWComponent
IlxWComponent.DynamicStyleMap
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.String
CSS_RESOURCE_NAME
Resource path to the user-agent CSS.-
Fields inherited from class ilog.webui.dhtml.IlxWContainer
listenerList
-
-
Constructor Summary
Constructors Constructor and Description IlrWSyntacticEditor()
Constructs a new Web Rule Editor.
-
Method Summary
Methods Modifier and Type Method and Description void
addTokenStyle(java.util.Vector tokens, java.lang.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(java.lang.String styleName)
Removes a style from a set of edited tokens.void
clearTokenStyles(java.util.Vector tokens, java.lang.String styleName)
Removes a style from a set of edited tokens.IlrWBRLSyntacticRuleElement
getBRLRuleElement()
Gets the rule currently edited by this rule editor.java.util.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 theDHTML
property.boolean
isEditable()
Returns the value of the Editable property.protected void
make(IlxWPort port)
protected void
printComponent(IlxWPort port)
Redefines theIlxWComponent.printComponent
method.void
redo()
Redo action.void
setAutoEditMode(boolean auto)
Sets the automatic edit mode property.void
setBRLRuleElement(ilog.rules.brl.IlrBRLRuleElement ruleElement, ilog.rules.vocabulary.model.IlrVocabulary vocabulary)
Deprecated.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.void
setDHtml(boolean dhtml)
Sets the value of theDHTML
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
-
-
-
-
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 theDHTML
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 istrue
with IE5.x, andfalse
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 theDHTML
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. Whenfalse
, the editor is in read-only mode.The default value for this property is
true
.
-
printComponent
protected void printComponent(IlxWPort port) throws java.io.IOException
Redefines the
IlxWComponent.printComponent
method.- Specified by:
printComponent
in classIlxWComponent
- Throws:
java.io.IOException
- Parameters:
port
- The port on which the component will be printed.- See Also:
IlxWComponent.print(ilog.webui.dhtml.IlxWPort)
-
addTokenStyle
public void addTokenStyle(java.util.Vector tokens, java.lang.String styleName)
Adds a style to a set of edited tokens.
- Parameters:
tokens
- AVector
containing editedIlrToken
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
- AVector
containing editedIlrToken
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)
Deprecated. Replaced bysetBRLRuleElement(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 thedhtml
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
-
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 thesetAuthorRules
method.This method returns
null
by default but is intended to be redefined by subclasses.- Overrides:
getUserAgentRules
in classIlxWContainer
- 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.
-
-