Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Data Visualization Components
11g Release 2 (11.1.2.2.0)

E17492-03


oracle.dss.rules
Class RuleBundle

java.lang.Object
  extended by oracle.dss.rules.RuleBundle

All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class RuleBundle
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

A collection of Rule objects. The order of the Rule objects in the RuleBundle determines the order in which the rules are run. The RuleBundle supports running all of the rules in the RuleBundle, resulting in a single Mergeable object, which a DataView then uses to paint an item. In cases where more than one rule sets the same property, the last rule to run sets the final value of the property.

All of the Rule objects in the RuleBundle must have compatible Mergeable objects. To be compatible, Mergeable objects should be the same class. For example, all of the rules should operate on ViewFormat objects or on ViewStyle objects, but not on some of each. A class and its subclass can be compatible if the merge method handles any properties that are in the subclass but not in the original class.

The RuleBundle actually contains clones of the Rule objects that you add to the bundle. If you change a Rule after you add it to a RuleBundle, then call the ReplaceRule method to replace the old Rule with the modified Rule.

See Also:
Serialized Form

Field Summary
protected  java.util.Hashtable m_context
           
static java.lang.String NAME_BUNDLE
           

 

Constructor Summary
RuleBundle()
          Constructor.

 

Method Summary
 void addRule(Rule rule)
          Adds a Rule to the end of this RuleBundle.
 void addRule(Rule rule, int index)
          Adds a Rule to this RuleBundle, at the specified index.
 void addRuleBundleListener(RuleBundleListener listener)
          Registers a listener for this RuleBundle.
 java.lang.Object clone()
          Clones this RuleBundle.
 void fireEvent(RuleBundleEvent e)
          Fires a RuleBundleEvent to all listeners.
 int getCount()
          Retrieves the number of rules in this RuleBundle.
 java.lang.String getID()
          Retrieves the identifier for this RuleBundle.
 Rule getRule(int index)
          Retrieves the Rule at the specified index.
 oracle.dss.util.xml.ObjectNode getXML(boolean allProperties, ComponentTypeConverter dataview)
          Retrieves XML that represents properties and their values in the form of and ObjectNode.
 oracle.dss.util.xml.ObjectNode getXML(boolean allProperties, ComponentTypeConverter dataview, java.lang.String name)
          Retrieves XML that represents properties and their values in the form of and ObjectNode.
 boolean isStopAtFirstMatch()
          Indicates whether the first Rule that applies in a RuleBundle is the last Rule that is run in the RuleBundle.
 void removeRule(int index)
          Removes the Rule at the specified index.
 void removeRule(Rule rule)
          Removes the specified Rule from this RuleBundle.
 void removeRuleBundleListener(RuleBundleListener listener)
          Removes the specified listener.
 void removeRulesThatApply(RuleContext context, Mergeable mergeable)
          Removes from this RuleBundle any Rule that applies in the specified context.
 void replaceRule(Rule rule, int index)
          Replaces a Rule with another Rule.
 boolean runRules(RuleContext context, Mergeable target)
          Runs each Rule in this RuleBundle.
 void setContext(java.util.Hashtable context)
           
 void setID(java.lang.String id)
          Specifies an identifier for this RuleBundle.
 void setStopAtFirstMatch(boolean v)
          Specifies whether the first Rule that applies in a RuleBundle is the last Rule that is run in the RuleBundle .
 void setXML(oracle.dss.util.xml.ContainerNode node, ComponentTypeConverter converter, java.lang.String version, int reset)
          Specifies XML that represents properties and values.

 

Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

m_context

protected java.util.Hashtable m_context
For internal use only. Application developers should not use this

NAME_BUNDLE

public static final java.lang.String NAME_BUNDLE
See Also:
Constant Field Values
For internal use only. Application developers should not use this

Constructor Detail

RuleBundle

public RuleBundle()
Constructor.

Method Detail

clone

public java.lang.Object clone()
Clones this RuleBundle. The clone contains a clone of each Rule in this RuleBundle.
Overrides:
clone in class java.lang.Object
Returns:
The clone of this RuleBundle.

getRule

public Rule getRule(int index)
Retrieves the Rule at the specified index. At this time, this method returns a reference to the Rule; it does not clone the Rule.
Parameters:
index - The index of the Rule that you want. Valid indexes are zero to the current size of this RuleBundle.
Returns:
The Rule at the specified index.

addRule

public void addRule(Rule rule)
Adds a Rule to the end of this RuleBundle. This method fires a RuleBundleEvent to notify listeners that the RuleBundle was modified.
Parameters:
rule - The Rule to add.

addRule

public void addRule(Rule rule,
                    int index)
Adds a Rule to this RuleBundle, at the specified index. This method fires a RuleBundleEvent to notify listeners that the RuleBundle was modified.
Parameters:
rule - The Rule to add.
index - The index at which to add the Rule. Valid values are zero to the current size of the RuleBundle.

addRuleBundleListener

public void addRuleBundleListener(RuleBundleListener listener)
Registers a listener for this RuleBundle.
Parameters:
listener - The listener to add.

runRules

public boolean runRules(RuleContext context,
                        Mergeable target)
                 throws RuleException
Runs each Rule in this RuleBundle. This method passes a single Mergeable object to be modified by all the Rules that are run and that apply.

If the isStopAtFirstMatch method returns true, then this method runs rules only until a rule applies. If isStopAtFirstMatch returns false, then this method runs all of the rules in the bundle.

Parameters:
context - Information about the data item in question. Rules use this information to test whether they apply.
target - The Mergeable object whose properties are to be modified by a Rule that applies.
Returns:
true if any Rule applies (that is, if the Mergeable is changed at all), false if no Rule applies.
Throws:
RuleException - If context is unusable for some reason or if any Rule in this RuleBundle has a problem.

getCount

public int getCount()
Retrieves the number of rules in this RuleBundle.
Returns:
The number of rules in this RuleBundle.

removeRuleBundleListener

public void removeRuleBundleListener(RuleBundleListener listener)
Removes the specified listener.
Parameters:
listener - The listener to remove.

fireEvent

public void fireEvent(RuleBundleEvent e)
Fires a RuleBundleEvent to all listeners. Currently, the RuleBundleEvent has one type, which indicates that the RuleBundle has been modified.

If you change a Rule in this RuleBundle, then you should call this method.

Parameters:
e - The RuleBundleEvent.

removeRule

public void removeRule(Rule rule)
Removes the specified Rule from this RuleBundle. This method fires a RuleBundleEvent to notify listeners that the RuleBundle was modified.
Parameters:
rule - The Rule to remove.

removeRule

public void removeRule(int index)
Removes the Rule at the specified index. This method fires a RuleBundleEvent to notify listeners that the RuleBundle was modified.
Parameters:
index - The index of the Rule to remove. Valid values are zero to the current size of the RuleBundle.

removeRulesThatApply

public void removeRulesThatApply(RuleContext context,
                                 Mergeable mergeable)
                          throws RuleException
Removes from this RuleBundle any Rule that applies in the specified context. If this method removes any rules, then it fires a RuleBundleEvent to notify listeners that the RuleBundle was modified.
Parameters:
context - Information about the DataView item in question. This method uses this information to test whether the rules apply.
mergeable - The Mergeable object that would be modified if the rules were run. This method does not run rules, so the Mergeable is not modified. Dynamic rules might use the Mergeable to see if they apply.
Throws:
RuleException - If context is unusable for some reason or if any Rule in this RuleBundle has a problem.

replaceRule

public void replaceRule(Rule rule,
                        int index)
Replaces a Rule with another Rule. This method fires a RuleBundleEvent to notify listeners that the RuleBundle was modified.
Parameters:
rule - The Rule that you want to put in this RuleBundle.
index - The index of the Rule that you want rule to replace.

setStopAtFirstMatch

public void setStopAtFirstMatch(boolean v)
Specifies whether the first Rule that applies in a RuleBundle is the last Rule that is run in the RuleBundle . This method affects the behavior of the runRules method. This method fires a RuleBundleEvent to notify listeners that the RuleBundle was modified.
Parameters:
v - true to stop rules from running after the first rule that applies is fired, false to have all the rules in the bundle run.

isStopAtFirstMatch

public boolean isStopAtFirstMatch()
Indicates whether the first Rule that applies in a RuleBundle is the last Rule that is run in the RuleBundle. The return value of this method affects the behavior of the runRules method.
Returns:
true if the first Rule that applies is the last Rule that runs, false if all the rules in the bundle are run.

setID

public void setID(java.lang.String id)
Specifies an identifier for this RuleBundle.
Parameters:
id - The String that identifies this RuleBundle.

getID

public java.lang.String getID()
Retrieves the identifier for this RuleBundle.
Returns:
returns The identifier for this RuleBundle.

setContext

public void setContext(java.util.Hashtable context)
Parameters:
context - A hashtable that a user can use to pass XMLContext One can also use this table to pass more information to its objects.
For internal use only. Application developers should not use this
sets the context

setXML

public void setXML(oracle.dss.util.xml.ContainerNode node,
                   ComponentTypeConverter converter,
                   java.lang.String version,
                   int reset)
Specifies XML that represents properties and values. This method applies the values of the properties in the XML to this Rule.
Parameters:
node - ObjectNode that has the properties and their values.
converter - A class that converts view component identifiers from strings to integers and back. Dataview objects implement the ComponentTypeConverter interface.
version - The XML version.
reset - A constant that indicates how much to reset when XML is applied. Valid values are listed in the See Also section.
See Also:
Rule.RESET_NONE, Rule.RESET_XML_PROPERTIES, Rule.RESET_EVERYTHING

getXML

public oracle.dss.util.xml.ObjectNode getXML(boolean allProperties,
                                             ComponentTypeConverter dataview)
Retrieves XML that represents properties and their values in the form of and ObjectNode.
Parameters:
allProperties - true to store all property values in XML, false to store only values that are different from default values.
dataview - A class that converts view component identifiers from strings to integers and back. Dataview objects implement the ComponentTypeConverter interface.
Returns:
XML for the properties and values.

getXML

public oracle.dss.util.xml.ObjectNode getXML(boolean allProperties,
                                             ComponentTypeConverter dataview,
                                             java.lang.String name)
Retrieves XML that represents properties and their values in the form of and ObjectNode.
Parameters:
allProperties - true to store all property values in XML, false to store only values that are different from default values.
dataview - A class that converts view component identifiers from strings to integers and back. Dataview objects implement the ComponentTypeConverter interface.
name - The element name to use in the XML.
Returns:
XML for the properties and values.

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Data Visualization Components
11g Release 2 (11.1.2.2.0)

E17492-03


Copyright © 1997, 2012, Oracle. All rights reserved.