Beispiel #1
0
 /// <summary>(non-Javadoc)</summary>
 /// <seealso cref="org.javarosa.core.services.properties.IPropertyRules.checkValueAllowed(String, String)">
 /// </seealso>
 public virtual bool checkValueAllowed(System.String propertyName, System.String potentialValue)
 {
     if (CURRENT_LOCALE.Equals(propertyName))
     {
         return(Localization.GlobalLocalizerAdvanced.hasLocale(potentialValue));
     }
     //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
     System.Collections.ArrayList prop = ((System.Collections.ArrayList)rules[propertyName]);
     if (prop.Count != 0)
     {
         //Check whether this is a dynamic property
         if (prop.Count == 1 && checkPropertyAllowed((System.String)prop[0]))
         {
             // If so, get its list of available values, and see whether the potentival value is acceptable.
             return(((System.Collections.ArrayList)PropertyManager._().getProperty((System.String)prop[0])).Contains(potentialValue));
         }
         else
         {
             //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
             return(((System.Collections.ArrayList)rules[propertyName]).Contains(potentialValue));
         }
     }
     else
     {
         return(true);
     }
 }
Beispiel #2
0
 /*
  * (non-Javadoc)
  * @see org.javarosa.core.services.properties.IPropertyRules#handlePropertyChanges(java.lang.String)
  */
 public virtual void handlePropertyChanges(System.String propertyName)
 {
     if (CURRENT_LOCALE.Equals(propertyName))
     {
         System.String locale = PropertyManager._().getSingularProperty(propertyName);
         Localization.Locale = locale;
     }
 }
Beispiel #3
0
        private void saveProperty(System.String propName, TreeElement node)
        {
            IAnswerData answer = node.getValue();

            System.String value_Renamed = (answer == null ? null : answer.DisplayText);
            if (propName != null && propName.Length > 0 && value_Renamed != null && value_Renamed.Length > 0)
            {
                PropertyManager._().setProperty(propName, value_Renamed);
            }
        }
Beispiel #4
0
        /// <summary> Preloads a StringData object for the preload type 'property'
        ///
        /// </summary>
        /// <param name="preloadParams">The parameters determining the property to be retrieved
        /// </param>
        /// <returns> A preload property value if the parameters can be parsed,
        /// null otherwise
        /// </returns>
        private IAnswerData preloadProperty(System.String preloadParams)
        {
            System.String propname = preloadParams;
            System.String propval  = PropertyManager._().getSingularProperty(propname);
            StringData    data     = null;

            if (propval != null && propval.Length > 0)
            {
                data = new StringData(propval);
            }
            return(data);
        }
Beispiel #5
0
 //need 'addpropery' too.
 public static System.String initializeProperty(System.String propName, System.String defaultValue)
 {
     System.Collections.ArrayList propVal = PropertyManager._().getProperty(propName);
     if (propVal == null || propVal.Count == 0)
     {
         propVal = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
         propVal.Add(defaultValue);
         PropertyManager._().setProperty(propName, propVal);
         //#if debug.output==verbose
         System.Console.Out.WriteLine("No default value for [" + propName + "]; setting to [" + defaultValue + "]");                 // debug
         //#endif
         return(defaultValue);
     }
     return((System.String)propVal[0]);
 }
Beispiel #6
0
        //need 'addpropery' too.
        public static String initializeProperty(String propName, String defaultValue)
        {
            ArrayList propVal = PropertyManager._().getProperty(propName);

            if (propVal == null || propVal.Count == 0)
            {
                propVal = new ArrayList();
                propVal.Add(defaultValue);
                PropertyManager._().setProperty(propName, propVal);
                //#if debug.output==verbose
                Console.WriteLine("No default value for [" + propName
                                  + "]; setting to [" + defaultValue + "]");       // debug
                //#endif
                return(defaultValue);
            }
            return((String)propVal[0]);
        }