Пример #1
0
 /// <summary> Adds a set of rules to be used by this PropertyManager.
 /// Note that rules sets are inclusive, they add new possible
 /// values, never remove possible values.
 ///
 /// </summary>
 /// <param name="rules">The set of rules to be added to the permitted list
 /// </param>
 public virtual void  addRules(IPropertyRules rules)
 {
     if (rules != null)
     {
         this.rulesList.Add(rules);
     }
 }
Пример #2
0
 /// <summary> Checks that a property is allowed to store a certain value.
 ///
 /// </summary>
 /// <param name="propertyName">The name of the property to be set
 /// </param>
 /// <param name="propertyValue">The value to be stored in the given property
 /// </param>
 /// <returns> true if the property given is allowed to be stored. false otherwise.
 /// </returns>
 public virtual bool checkValueAllowed(System.String propertyName, System.String propertyValue)
 {
     if (rulesList.Count == 0)
     {
         return(true);
     }
     else
     {
         bool allowed = false;
         System.Collections.IEnumerator en = rulesList.GetEnumerator();
         //UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationhasMoreElements'"
         while (en.MoveNext() && !allowed)
         {
             //UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationnextElement'"
             IPropertyRules rules = (IPropertyRules)en.Current;
             if (rules.checkPropertyAllowed(propertyName))
             {
                 if (rules.checkValueAllowed(propertyName, propertyValue))
                 {
                     allowed = true;
                 }
             }
         }
         return(allowed);
     }
 }
Пример #3
0
        /// <summary> Identifies the property rules set that the property belongs to, and notifies
        /// it about the property change.
        ///
        /// </summary>
        /// <param name="property">The property that has been changed
        /// </param>
        private void  notifyChanges(System.String property)
        {
            if (rulesList.Count == 0)
            {
                return;
            }

            bool notified = false;

            System.Collections.IEnumerator rules = rulesList.GetEnumerator();
            //UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationhasMoreElements'"
            while (rules.MoveNext() && !notified)
            {
                //UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationnextElement'"
                IPropertyRules therules = (IPropertyRules)rules.Current;
                if (therules.checkPropertyAllowed(property))
                {
                    therules.handlePropertyChanges(property);
                }
            }
        }
Пример #4
0
 /// <summary> Sets the rules that should be used by this PropertyManager, removing any other
 /// existing rules sets.
 ///
 /// </summary>
 /// <param name="rules">The rules to be used.
 /// </param>
 public virtual void  setRules(IPropertyRules rules)
 {
     this.rulesList.Clear();
     this.rulesList.Add(rules);
 }