示例#1
0
 public override string getValueDisplay(int component, Locale locale)
 {
     if (component < 1 || component > 4)
     {
         throw new System.ArgumentException("invalid component number " + component + " for field 281");
     }
     if (component == 1)
     {
         //time
         java.text.DateFormat f   = new java.text.SimpleDateFormat("HH:mm", notNull(locale));
         DateTime             cal = Component1AsCalendar;
         if (cal != null)
         {
             return(f.format(cal.Ticks));
         }
     }
     if (component == 2)
     {
         //default format (as is)
         return(getComponent(2));
     }
     if (component == 3)
     {
         //default format (as is)
         return(getComponent(3));
     }
     if (component == 4)
     {
         //default format (as is)
         return(getComponent(4));
     }
     return(null);
 }
示例#2
0
 public override string getValueDisplay(int component, Locale locale)
 {
     if (component < 1 || component > 3)
     {
         throw new System.ArgumentException("invalid component number " + component + " for field 109");
     }
     if (component == 1)
     {
         //date
         java.text.DateFormat f   = java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale));
         DateTime             cal = Component1AsCalendar;
         if (cal != null)
         {
             return(f.format(cal.Ticks));
         }
     }
     if (component == 2)
     {
         //time with seconds
         java.text.DateFormat f   = new java.text.SimpleDateFormat("HH:mm:ss", notNull(locale));
         DateTime             cal = Component2AsCalendar;
         if (cal != null)
         {
             return(f.format(cal.Ticks));
         }
     }
     if (component == 3)
     {
         //default format (as is)
         return(getComponent(3));
     }
     return(null);
 }
示例#3
0
 /// <summary>
 /// Returns a localized suitable for showing to humans string of a field component.<br>
 /// </summary>
 /// <param name="component"> number of the component to display </param>
 /// <param name="locale"> optional locale to format date and amounts, if null, the default locale is used </param>
 /// <returns> formatted component value or null if component number is invalid or not present </returns>
 /// <exception cref="IllegalArgumentException"> if component number is invalid for the field
 /// @since 7.8 </exception>
 public override string getValueDisplay(int component, Locale locale)
 {
     if (component < 1 || component > 2)
     {
         throw new System.ArgumentException("invalid component number " + component + " for field 172");
     }
     if (component == 1)
     {
         //monthday
         java.text.DateFormat f   = new java.text.SimpleDateFormat("MMM", notNull(locale));
         DateTime             cal = Component1AsCalendar;
         if (cal != null)
         {
             return(f.format(cal.Ticks));
         }
     }
     if (component == 2)
     {
         //monthday
         java.text.DateFormat f   = new java.text.SimpleDateFormat("MMM", notNull(locale));
         DateTime             cal = Component2AsCalendar;
         if (cal != null)
         {
             return(f.format(cal.Ticks));
         }
     }
     return(null);
 }
示例#4
0
 /// <summary>
 /// Returns a localized suitable for showing to humans string of a field component.<br>
 /// </summary>
 /// <param name="component"> number of the component to display </param>
 /// <param name="locale"> optional locale to format date and amounts, if null, the default locale is used </param>
 /// <returns> formatted component value or null if component number is invalid or not present </returns>
 /// <exception cref="IllegalArgumentException"> if component number is invalid for the field
 /// @since 7.8 </exception>
 public override string getValueDisplay(int component, Locale locale)
 {
     if (component < 1 || component > 6)
     {
         throw new System.ArgumentException("invalid component number " + component + " for field 258");
     }
     if (component == 1)
     {
         //default format (as is)
         return(getComponent(1));
     }
     if (component == 2)
     {
         //number, amount, rate
         java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(notNull(locale));
         f.MaximumFractionDigits = 13;
         Number n = Component2AsNumber;
         if (n != null)
         {
             return(f.format(n));
         }
     }
     if (component == 3)
     {
         //default format (as is)
         return(getComponent(3));
     }
     if (component == 4)
     {
         //date
         java.text.DateFormat f   = java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale));
         DateTime             cal = Component4AsCalendar;
         if (cal != null)
         {
             return(f.format(cal.Ticks));
         }
     }
     if (component == 5)
     {
         //time
         java.text.DateFormat f   = new java.text.SimpleDateFormat("HH:mm", notNull(locale));
         DateTime             cal = Component5AsCalendar;
         if (cal != null)
         {
             return(f.format(cal.Ticks));
         }
     }
     if (component == 6)
     {
         //time
         java.text.DateFormat f   = new java.text.SimpleDateFormat("HH:mm", notNull(locale));
         DateTime             cal = Component6AsCalendar;
         if (cal != null)
         {
             return(f.format(cal.Ticks));
         }
     }
     return(null);
 }
示例#5
0
 /// <summary>
 /// Returns a localized suitable for showing to humans string of a field component.<br>
 /// </summary>
 /// <param name="component"> number of the component to display </param>
 /// <param name="locale"> optional locale to format date and amounts, if null, the default locale is used </param>
 /// <returns> formatted component value or null if component number is invalid or not present </returns>
 /// <exception cref="IllegalArgumentException"> if component number is invalid for the field
 /// @since 7.8 </exception>
 public override string getValueDisplay(int component, Locale locale)
 {
     if (component < 1 || component > 1)
     {
         throw new System.ArgumentException("invalid component number " + component + " for field 142");
     }
     if (component == 1)
     {
         //date + time
         java.text.DateFormat df  = java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale));
         java.text.DateFormat tf  = new java.text.SimpleDateFormat("HH:mm", notNull(locale));
         DateTime             cal = Component1AsCalendar;
         if (cal != null)
         {
             return(df.format(cal.Ticks) + " " + tf.format(cal.Ticks));
         }
     }
     return(null);
 }