public class IlrWSyntacticEditor extends IlxWComponent implements ilog.webui.dhtml.IlxWConstants
IlrWSyntacticEditor
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.
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;
}
IlxWComponent.DynamicStyleMap| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CSS_RESOURCE_NAME
Resource path to the user-agent CSS.
|
listenerList| Constructor and Description |
|---|
IlrWSyntacticEditor()
Constructs a new Web Rule Editor.
|
| 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 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 |
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 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.
|
addPropertyChangeListener, addPropertyChangeListener, detach, doPrint, firePropertyChange, firePropertyChange, getName, getRealHtmlTagName, getStyle, invalidate, isInvalidated, notifyDependencies, print, removePropertyChangeListener, removePropertyChangeListener, setName, validateadd, add, getAttribute, getAttributeNames, getComponent, getComponentCount, getComponentNamed, getComponents, getManager, getParent, indexOf, isAncestorOf, remove, remove, removeAll, removeAttribute, setAttribute, setAuthorRules, setFinalizerpublic static final java.lang.String CSS_RESOURCE_NAME
public IlrWSyntacticEditor()
Constructs a new Web Rule Editor.
public void setDHtml(boolean dhtml)
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.
dhtml - The new value of the DHTML property.isDHtml(ilog.webui.dhtml.IlxWPort)public boolean isDHtml(IlxWPort port)
Gets the value of the DHTML property.
true if the Web Rule Editor is in DHTML mode
and the browser supports this mode; false otherwise.setDHtml(boolean)public boolean isEditable()
Returns the value of the Editable property.
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.
protected void printComponent(IlxWPort port) throws java.io.IOException
Redefines the IlxWComponent.printComponent method.
printComponent in class IlxWComponentjava.io.IOExceptionport - The port on which the component will be printed.IlxWComponent.print(ilog.webui.dhtml.IlxWPort)public void addTokenStyle(java.util.Vector tokens,
java.lang.String styleName)
Adds a style to a set of edited tokens.
tokens - A Vector
containing edited IlrToken objects.styleName - The name of a style defined in
the current graphic resources.clearTokenStyles(Vector, String)public void clearTokenStyles(java.util.Vector tokens,
java.lang.String styleName)
Removes a style from a set of edited tokens.
tokens - A Vector
containing edited IlrToken objects.styleName - The name of a style defined in
the current graphic resources.addTokenStyle(Vector, String)public void clearTokenStyles(java.lang.String styleName)
Removes a style from a set of edited tokens.
styleName - The name of a style defined in
the current graphic resources.addTokenStyle(Vector, String)public void setBRLRuleElement(IlrWBRLSyntacticRuleElement ruleElement, java.util.Locale locale)
ruleElement - The rule to be edited.locale - The locale in which the rule should be edited.public IlrWBRLSyntacticRuleElement getBRLRuleElement()
public java.util.Locale getLocale()
public void setBRLRuleElement(ilog.rules.brl.IlrBRLRuleElement ruleElement,
ilog.rules.vocabulary.model.IlrVocabulary vocabulary)
setBRLRuleElement(IlrWBRLSyntacticRuleElement, Locale)ruleElement - The rule to be edited.public void setVariableProvider(ilog.rules.brl.brldf.IlrBRLVariableProvider variableProvider)
variableProvider - The variable provider.public ilog.rules.brl.brldf.IlrBRLVariableProvider getVariableProvider()
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.
public void setAutoEditMode(boolean auto)
Sets the automatic edit mode property.
isAutoEditMode()protected void make(IlxWPort port) throws java.io.IOException
java.io.IOExceptionprotected IlxWCSSRuleset getUserAgentRules()
IlxWContainersetAuthorRules method.
This method returns null by default but is intended
to be redefined by subclasses.
getUserAgentRules in class IlxWContainerIlxWContainer.setAuthorRules(ilog.webui.dhtml.IlxWCSSRuleset)public void setUndoLimit(int limit)
Sets the undo limit.
By default the undo limit is set to 100.
limit - The new undo limit (an integer greater or equal to 0).getUndoLimit()public int getUndoLimit()
Gets the undo limit.
setUndoLimit(int)public void undo()
If the undo is not possible, this method has no effect.
public boolean canUndo()
Specifies whether the 'undo' action is possible.
public void redo()
If the redo is not possible, this method has no effect.
public boolean canRedo()
Specifies whether the redo action is possible.
© Copyright IBM Corp. 1987, 2017