예제 #1
0
  /**
   * Create an instance of JCalendar using the given calendar and locale. Display a calendar and/or
   * a time spinner as requested (to display both use DISPLAY_DATE | DISPLAY_TIME). Display today's
   * date if requested. Set the pattern used to display the time in the time spinner field (if there
   * is one). If null, use the default MEDIUM format for the given locale. Patterns are from
   * DateFormat and SimpleDateFormat.
   *
   * @param calendar The calendar to use.
   * @param locale The locale to use.
   * @param selectedComponents Use DISPLAY_DATE, DISPLAY_TIME or (DISPLAY_DATE | DISPLAY_TIME).
   * @param isTodayDisplayed True if today's date should be displayed at the bottom of the panel.
   * @param timePattern The pattern used to display the time in the time spinner field.
   * @see DateFormat
   * @see SimpleDateFormat
   */
  public JCalendar(
      Calendar calendar,
      Locale locale,
      int selectedComponents,
      boolean isTodayDisplayed,
      String timePattern) {
    this.selectedCalendar = (Calendar) calendar.clone();
    this.displayCalendar = (Calendar) selectedCalendar.clone();
    this.selectedComponents = selectedComponents;
    if ((selectedComponents & (DISPLAY_DATE | DISPLAY_TIME)) == 0) {
      throw new IllegalStateException(bundle.getString("IllegalStateException"));
    }

    this.locale = locale;
    this.isTodayDisplayed = isTodayDisplayed;

    if ((selectedComponents & DISPLAY_TIME) > 0) {
      if (timePattern == null) {
        DateFormat timeFormat = DateFormat.getTimeInstance(DateFormat.MEDIUM, locale);
        this.timePattern = "HH:mm:ss";
        if (timeFormat instanceof SimpleDateFormat) {
          this.timePattern = ((SimpleDateFormat) timeFormat).toPattern();
        }
      } else {
        this.timePattern = timePattern;
      }
    }

    createCalendarComponents();
    setDate(new Date());
  }
예제 #2
0
  /** {@inheritDoc} */
  protected String paramString() {
    String curDate;
    if ((selectedComponents & DISPLAY_DATE) == DISPLAY_DATE) {
      curDate = DateFormat.getDateInstance(DateFormat.FULL, locale).format(getDate());
    } else if ((selectedComponents & DISPLAY_TIME) == DISPLAY_TIME) {
      curDate = DateFormat.getTimeInstance(DateFormat.FULL, locale).format(getDate());
    } else {
      curDate =
          DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, locale)
              .format(getDate());
    }

    return super.paramString() + ",selectedDate=" + curDate;
  }
 /** Constructor */
 public SOAPMonitorData(Long id, String target, String soap_request) {
   this.id = id;
   // A null id is used to signal that the "most recent" entry
   // is being created.
   if (id == null) {
     this.time = "Most Recent";
     this.target = "---";
     this.soap_request = null;
     this.soap_response = null;
   } else {
     this.time = DateFormat.getTimeInstance().format(new Date());
     this.target = target;
     this.soap_request = soap_request;
     this.soap_response = null;
   }
 }
예제 #4
0
  /*==========================================================
   * public methods
   *==========================================================*/
  public Vector parse(Object entry) throws ParseException {
    String logEntry = (String) entry;
    // parsing the log Entry and return segments
    // Debug.println("LogDataModel: DefaultLogParser: parse() -" +logEntry);
    int x = logEntry.indexOf("[");
    if (x == -1) throw new ParseException(logEntry, 0);
    String temp = logEntry.substring(x + 1);
    x = temp.indexOf("]");
    if (x == -1) throw new ParseException(logEntry, 0);

    String dateStr = temp.substring(0, x);
    // Debug.println("LogDataModel: DefaultLogParser: parse() -"+dateStr+" "+temp);
    SimpleDateFormat format = new SimpleDateFormat(DATE_PATTERN);
    Date date = format.parse(dateStr);
    String dateColumn = DateFormat.getDateInstance().format(date);
    String timeColumn = DateFormat.getTimeInstance().format(date);

    // Debug.println("LogDataModel: DefaultLogParser: parse() -"+dateColumn+" "+timeColumn);
    temp = temp.substring(x + 2);
    x = temp.indexOf("]");
    if (x == -1) throw new ParseException(logEntry, 0);
    String source = temp.substring(1, x);
    temp = temp.substring(x + 2);
    x = temp.indexOf("]");
    if (x == -1) throw new ParseException(logEntry, 0);
    String level = temp.substring(1, x);
    temp = temp.substring(x + 2);
    Vector row = new Vector();
    row.addElement(getSourceString(source));
    row.addElement(getLevelString(level));
    row.addElement(dateColumn);
    row.addElement(timeColumn);
    JLabel detail = new JLabel(temp);
    detail.setToolTipText(temp);
    row.addElement(detail);
    return row;
  }