/**
  * The <code>OrganizationElement</code> implementation of this <code>IPropertySource</code> method
  * defines the following Setable properties
  *
  * <p>1) P_ADDRESS, expects Address 2) P_FULLNAME, expects Name 3) P_PHONENUMBER, expects String
  * 4) P_EMAIL, expects EmailAddress. 5) P_BOOLEAN, expects Boolean, whether the individual is a
  * coop student or not 6) P_BDAY, expects Birthday 7) P_SALARY, expects java.lang.Float 8)
  * P_HAIRCOLOR, expects RGB 9) P_EYECOLOR, expects RGB
  */
 public void setPropertyValue(Object propKey, Object val) {
   // need to convert from String to domain objects
   if (propKey.equals(P_ID_ADDRESS)) {
     // setAddress((Address)val);
     return;
   }
   if (propKey.equals(P_ID_FULLNAME)) {
     setFullName(new Name((String) val));
     return;
   }
   if (propKey.equals(P_ID_PHONENUMBER)) {
     setPhoneNumber((String) val);
     return;
   }
   if (propKey.equals(P_ID_EMAIL)) {
     setEmailAddress(new EmailAddress((String) val));
     return;
   }
   if (propKey.equals(P_ID_COOP)) {
     setCoop(((Integer) val).equals(P_VALUE_TRUE) ? Boolean.TRUE : Boolean.FALSE);
   }
   if (propKey.equals(P_ID_BDAY)) {
     // setBirthday((Birthday)val);
     return;
   }
   if (propKey.equals(P_ID_SALARY)) {
     try {
       setSalary(new Float(Float.parseFloat((String) val)));
     } catch (NumberFormatException e) {
       setSalary(salary_Default);
     }
     return;
   }
   if (propKey.equals(P_ID_HAIRCOLOR)) {
     setHairColor((RGB) val);
     return;
   }
   if (propKey.equals(P_ID_EYECOLOR)) {
     setEyeColor((RGB) val);
     return;
   }
   super.setPropertyValue(propKey, val);
 }
 /* (non-Javadoc)
  * Method declared on IPropertySource
  */
 public void resetPropertyValue(Object property) {
   if (property.equals(P_ID_ADDRESS)) {
     setAddress(address_Default);
     return;
   }
   if (property.equals(P_ID_FULLNAME)) {
     setFullName(fullName_Default);
     return;
   }
   if (property.equals(P_ID_PHONENUMBER)) {
     setPhoneNumber(phoneNumber_Default);
     return;
   }
   if (property.equals(P_ID_EMAIL)) {
     setEmailAddress(emailAddress_Default);
     return;
   }
   if (property.equals(P_ID_COOP)) {
     setCoop(coop_Default);
   }
   if (property.equals(P_ID_BDAY)) {
     setBirthday(birthday_Default);
     return;
   }
   if (property.equals(P_ID_SALARY)) {
     setSalary(salary_Default);
     return;
   }
   if (property.equals(P_ID_HAIRCOLOR)) {
     setHairColor(hairColor_Default);
     return;
   }
   if (property.equals(P_ID_EYECOLOR)) {
     setEyeColor(eyeColor_Default);
     return;
   }
   super.resetPropertyValue(property);
 }
  static {
    descriptors = new Vector();
    PropertyDescriptor propertyDescriptor;

    ///
    propertyDescriptor = new TextPropertyDescriptor(P_ID_PHONENUMBER, P_PHONENUMBER);
    propertyDescriptor.setCategory(P_CONTACTINFO);
    propertyDescriptor.setHelpContextIds(PHONE_NUMBER_CONTEXT);
    descriptors.addElement(propertyDescriptor);

    ///
    propertyDescriptor = new PropertyDescriptor(P_ID_ADDRESS, P_ADDRESS);
    propertyDescriptor.setCategory(P_CONTACTINFO);
    propertyDescriptor.setHelpContextIds(ADDRESS_CONTEXT);
    descriptors.addElement(propertyDescriptor);

    ///
    propertyDescriptor = new TextPropertyDescriptor(P_ID_EMAIL, P_EMAIL);
    propertyDescriptor.setCategory(P_CONTACTINFO);
    propertyDescriptor.setHelpContextIds(EMAIL_CONTEXT);
    propertyDescriptor.setValidator(new EmailAddressValidator());
    descriptors.addElement(propertyDescriptor);

    ///
    propertyDescriptor = new TextPropertyDescriptor(P_ID_FULLNAME, P_FULLNAME);
    propertyDescriptor.setCategory(P_PERSONELINFO);
    propertyDescriptor.setHelpContextIds(FULL_NAME_CONTEXT);
    descriptors.addElement(propertyDescriptor);

    ///
    propertyDescriptor = new PropertyDescriptor(P_ID_BDAY, P_BDAY);
    propertyDescriptor.setCategory(P_PERSONELINFO);
    propertyDescriptor.setHelpContextIds(BIRTHDAY_CONTEXT);
    descriptors.addElement(propertyDescriptor);

    ///
    propertyDescriptor =
        new ComboBoxPropertyDescriptor(
            P_ID_COOP, P_COOP, new String[] {P_VALUE_TRUE_LABEL, P_VALUE_FALSE_LABEL});
    propertyDescriptor.setCategory(P_PERSONELINFO);
    propertyDescriptor.setHelpContextIds(COOP_CONTEXT);
    propertyDescriptor.setLabelProvider(new BooleanLabelProvider());
    descriptors.addElement(propertyDescriptor);

    ///
    propertyDescriptor = new TextPropertyDescriptor(P_ID_SALARY, P_SALARY);
    // add custom validator to propertyDescriptor limiting salary values to be
    // greator than zero
    propertyDescriptor.setHelpContextIds(new Object[] {SALARY_CONTEXT});
    propertyDescriptor.setFilterFlags(new String[] {IPropertySheetEntry.FILTER_ID_EXPERT});
    propertyDescriptor.setValidator(
        new ICellEditorValidator() {
          public String isValid(Object value) {
            if (value == null) return MessageUtil.getString("salary_is_invalid"); // $NON-NLS-1$
            //
            Float trySalary;
            try {
              trySalary = new Float(Float.parseFloat((String) value));
            } catch (NumberFormatException e) {
              return MessageUtil.getString("salary_is_invalid"); // $NON-NLS-1$
            }
            if (trySalary.floatValue() < 0.0)
              return MessageUtil.getString("salary_must_be_greator_than_zero"); // $NON-NLS-1$
            return null;
          }
        });
    propertyDescriptor.setCategory(P_PERSONELINFO);
    descriptors.addElement(propertyDescriptor);

    /// HairColor
    propertyDescriptor = new ColorPropertyDescriptor(P_ID_HAIRCOLOR, P_HAIRCOLOR);
    propertyDescriptor.setCategory(P_PERSONALINFO);
    propertyDescriptor.setHelpContextIds(HAIR_COLOR__CONTEXT);
    descriptors.addElement(propertyDescriptor);

    /// EyeColor
    propertyDescriptor = new ColorPropertyDescriptor(P_ID_EYECOLOR, P_EYECOLOR);
    propertyDescriptor.setCategory(P_PERSONALINFO);
    propertyDescriptor.setHelpContextIds(EYE_COLOR_CONTEXT);
    descriptors.addElement(propertyDescriptor);

    // gets descriptors from parent, warning name-space collision may occur
    Vector parentDescriptors = OrganizationElement.getDescriptors();
    for (int i = 0; i < parentDescriptors.size(); i++) {
      descriptors.addElement(parentDescriptors.elementAt(i));
    }
  }