Example #1
0
  /**
   * Checks if the String in the date box input field is a valid date format.
   *
   * <p>
   *
   * @return <code>true</code> if the String in the date box input field is a valid date format
   */
  public boolean isValideDateBox() {

    try {
      CmsDateConverter.toDate(m_box.getText());
      return true;
    } catch (Exception e) {
      return false;
    }
  }
Example #2
0
  /** @see com.google.gwt.user.client.ui.HasValue#getValue() */
  public Date getValue() {

    Date date = null;
    if (isEnabled()) {
      try {
        date = CmsDateConverter.toDate(m_box.getText());
        setErrorMessage(null);
      } catch (Exception e) {
        setErrorMessage(Messages.get().key(Messages.ERR_DATEBOX_INVALID_DATE_FORMAT_0));
      }
    }
    return date;
  }
Example #3
0
  /**
   * Returns the time text field value as string.
   *
   * <p>
   *
   * @return the time text field value as string
   */
  private String getTimeText() {

    String timeAsString = m_time.getText().trim();
    if (CmsDateConverter.is12HourPresentation()) {
      if (!(timeAsString.contains(CmsDateConverter.AM)
          || timeAsString.contains(CmsDateConverter.PM))) {
        if (m_am.isChecked()) {
          timeAsString = timeAsString + " " + CmsDateConverter.AM;
        } else {
          timeAsString = timeAsString + " " + CmsDateConverter.PM;
        }
      }
    }
    return timeAsString;
  }