protected void setControlData() {
   try {
     // only in edit mode, only if the metadata properties exist
     if (theMode == SelectorDialogModes.TEXT_EDIT) {
       if (ooDocument.propertyExists("Bungeni_DebateOfficialDate")
           && ooDocument.propertyExists("Bungeni_DebateOfficialTime")) {
         ooDocMetadata meta = new ooDocMetadata(ooDocument);
         String strDate = meta.GetProperty("Bungeni_DebateOfficialDate");
         String strTime = meta.GetProperty("Bungeni_DebateOfficialTime");
         SimpleDateFormat formatter = new SimpleDateFormat("MMMM dd yyyy");
         this.dt_initdebate_hansarddate.setDate(formatter.parse(strDate));
         SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm");
         this.dt_initdebate_timeofhansard.setValue(timeFormat.parse(strTime));
       }
     }
   } catch (ParseException ex) {
     log.error("SetControlData: " + ex.getMessage());
   }
 }
Esempio n. 2
0
  @Override
  protected void initFieldsEdit() {
    dt_initdebate_timeofhansard.setModel(
        new SpinnerDateModel(new Date(), null, null, Calendar.HOUR));
    dt_initdebate_timeofhansard.setEditor(
        new JSpinner.DateEditor(dt_initdebate_timeofhansard, "HH:mm"));
    ((JSpinner.DefaultEditor) dt_initdebate_timeofhansard.getEditor())
        .getTextField()
        .setEditable(false);

    if (getOoDocument().propertyExists("Bungeni_DebateOfficialTime")) {
      try {
        ooDocMetadata meta = new ooDocMetadata(getOoDocument());
        String strTime = meta.GetProperty("Bungeni_DebateOfficialTime");
        SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm");
        dt_initdebate_timeofhansard.setValue(timeFormat.parse(strTime));
      } catch (ParseException ex) {
        log.error("initFieldsEdit : " + ex.getMessage());
      }
    }
    return;
  }