Esempio n. 1
0
 private static void drawQualification(final Page page, final Qualification qualification)
     throws IOException {
   page.tableStart("tstyle2 thwhite thnowrap thlight thleft thtop ulnomargin ");
   if (qualification != null) {
     final QualificationType type = qualification.getType();
     page.rowStart().header("Type:").column(type == null ? "-" : type.getLocalizedName()).rowEnd();
     final String degree = qualification.getDegree();
     page.rowStart().header("Scientific Field:").column(degree == null ? "-" : degree).rowEnd();
     final String school = qualification.getSchool();
     page.rowStart().header("Institution:").column(school == null ? "-" : school).rowEnd();
     final String mark = qualification.getMark();
     page.rowStart().header("Grade:").column(mark == null ? "-" : mark).rowEnd();
     final Partial attendedBegin = qualification.getAttendedBegin();
     page.rowStart()
         .header("Attended from:")
         .column(attendedBegin == null ? "-" : attendedBegin.toString("MM/yyyy"))
         .rowEnd();
     final Partial attendedEnd = qualification.getAttendedEnd();
     page.rowStart()
         .header("Attended to:")
         .column(attendedEnd == null ? "-" : attendedEnd.toString("MM/yyyy"))
         .rowEnd();
   }
   page.tableEnd();
 }
    private Object convertCalendarToPartial(Class type, Calendar calendar) throws Exception {
      if (type.equals(Partial.class)) {
        Partial partial = new Partial();
        if (isHour()) {
          partial = partial.with(DateTimeFieldType.hourOfDay(), calendar.get(Calendar.HOUR_OF_DAY));
        }
        if (isMinute()) {
          partial = partial.with(DateTimeFieldType.minuteOfHour(), calendar.get(Calendar.MINUTE));
        }
        return partial;
      } else {
        // ASSUMPTION
        // assume that we want a subtype of BasePartial and that the
        // subtype implements the factory
        // method fromCalendarField(Calendar calendar)
        Method method = type.getMethod("fromCalendarFields", new Class[] {Calendar.class});

        return method.invoke(null, new Object[] {calendar});
      }
    }
Esempio n. 3
0
 private static YearMonthDay getDateFromPartial(Partial partial) {
   return new YearMonthDay(
       partial.get(DateTimeFieldType.year()), partial.get(DateTimeFieldType.monthOfYear()), 1);
 }
Esempio n. 4
0
 public static String getPartialString(Partial partial) {
   return partial.toString("MMyyyy");
 }
Esempio n. 5
0
 /**
  * Sets this field in a copy of the Partial to a parsed text value.
  *
  * <p>The Partial attached to this property is unchanged by this call. Instead, a new instance
  * is returned.
  *
  * @param text the text value to set
  * @param locale optional locale to use for selecting a text symbol
  * @return a copy of the Partial with the field value changed
  * @throws IllegalArgumentException if the text value isn't valid
  */
 public Partial setCopy(String text, Locale locale) {
   int[] newValues = iPartial.getValues();
   newValues = getField().set(iPartial, iFieldIndex, newValues, text, locale);
   return new Partial(iPartial, newValues);
 }
Esempio n. 6
0
 /**
  * Sets this field in a copy of the Partial.
  *
  * <p>The Partial attached to this property is unchanged by this call. Instead, a new instance
  * is returned.
  *
  * @param value the value to set the field in the copy to
  * @return a copy of the Partial with the field value changed
  * @throws IllegalArgumentException if the value isn't valid
  */
 public Partial setCopy(int value) {
   int[] newValues = iPartial.getValues();
   newValues = getField().set(iPartial, iFieldIndex, newValues, value);
   return new Partial(iPartial, newValues);
 }
Esempio n. 7
0
 /**
  * Adds to the value of this field in a copy of this Partial wrapping within this field if the
  * maximum value is reached.
  *
  * <p>The value will be added to this field. If the value is too large to be added solely to
  * this field then it wraps within this field. Other fields are unaffected.
  *
  * <p>For example, <code>2004-12-20</code> addWrapField one month returns <code>2004-01-20
  * </code>.
  *
  * <p>The Partial attached to this property is unchanged by this call. Instead, a new instance
  * is returned.
  *
  * @param valueToAdd the value to add to the field in the copy
  * @return a copy of the Partial with the field value changed
  * @throws IllegalArgumentException if the value isn't valid
  */
 public Partial addWrapFieldToCopy(int valueToAdd) {
   int[] newValues = iPartial.getValues();
   newValues = getField().addWrapField(iPartial, iFieldIndex, newValues, valueToAdd);
   return new Partial(iPartial, newValues);
 }
Esempio n. 8
0
 /**
  * Gets the value of this field.
  *
  * @return the field value
  */
 public int get() {
   return iPartial.getValue(iFieldIndex);
 }
Esempio n. 9
0
 /**
  * Gets the field that this property uses.
  *
  * @return the field
  */
 public DateTimeField getField() {
   return iPartial.getField(iFieldIndex);
 }