@@ -94,6 +94,7 @@ public class EventBrowser extends javax.swing.JPanel {
9494 private EventBrowserAdvancedFilter advancedSearchPopup ;
9595 private Map <Integer , String > userMapById = new LinkedHashMap <Integer , String >();
9696 private SwingWorker <Void , Void > worker ;
97+ private boolean use24hourNotation = true ;
9798
9899 /**
99100 * Constructs the new event browser and sets up its default information/layout.
@@ -138,6 +139,7 @@ public void mouseReleased(java.awt.event.MouseEvent evt) {
138139 public void propertyChange (PropertyChangeEvent arg0 ) {
139140 allDayCheckBox .setEnabled (startDatePicker .getDate () != null || endDatePicker .getDate () != null );
140141 startTimePicker .setEnabled (startDatePicker .getDate () != null && !allDayCheckBox .isSelected ());
142+ hourNotation24 .setEnabled (startDatePicker .getDate () != null || endDatePicker .getDate () != null );
141143 }
142144 });
143145
@@ -146,6 +148,7 @@ public void propertyChange(PropertyChangeEvent arg0) {
146148 public void propertyChange (PropertyChangeEvent arg0 ) {
147149 allDayCheckBox .setEnabled (startDatePicker .getDate () != null || endDatePicker .getDate () != null );
148150 endTimePicker .setEnabled (endDatePicker .getDate () != null && !allDayCheckBox .isSelected ());
151+ hourNotation24 .setEnabled (startDatePicker .getDate () != null || endDatePicker .getDate () != null );
149152 }
150153 });
151154
@@ -207,7 +210,7 @@ public void loadNew(String eventNameFilter) {
207210 }
208211
209212 private Calendar getCalendar (MirthDatePicker datePicker , MirthTimePicker timePicker ) throws ParseException {
210- DateFormatter timeFormatter = new DateFormatter (new SimpleDateFormat ("hh:mm aa" ));
213+ DateFormatter timeFormatter = new DateFormatter (new SimpleDateFormat (use24hourNotation ? "HH:mm" : "hh:mm aa" ));
211214 Date date = datePicker .getDate ();
212215 String time = timePicker .getDate ();
213216
@@ -582,6 +585,7 @@ public void resetSearchCriteria() {
582585 endDatePicker .setDate (null );
583586 nameField .setText ("" );
584587 allDayCheckBox .setSelected (false );
588+ hourNotation24 .setSelected (true );
585589 levelBoxInformation .setSelected (false );
586590 levelBoxWarning .setSelected (false );
587591 levelBoxError .setSelected (false );
@@ -892,6 +896,7 @@ private void initComponents() {
892896 eventAttributesTable = null ;
893897 resetButton = new javax .swing .JButton ();
894898 allDayCheckBox = new com .mirth .connect .client .ui .components .MirthCheckBox ();
899+ hourNotation24 = new com .mirth .connect .client .ui .components .MirthCheckBox ();
895900 lastSearchCriteriaPane = new javax .swing .JScrollPane ();
896901 lastSearchCriteria = new javax .swing .JTextArea ();
897902 nextPageButton = new javax .swing .JButton ();
@@ -909,8 +914,8 @@ private void initComponents() {
909914 endDatePicker = new com .mirth .connect .client .ui .components .MirthDatePicker ();
910915 startDatePicker = new com .mirth .connect .client .ui .components .MirthDatePicker ();
911916 nameField = new javax .swing .JTextField ();
912- startTimePicker = new com .mirth .connect .client .ui .components .MirthTimePicker ();
913- endTimePicker = new com .mirth .connect .client .ui .components .MirthTimePicker ();
917+ startTimePicker = new com .mirth .connect .client .ui .components .MirthTimePicker (( use24hourNotation ? "HH:mm" : "hh:mm aa" ), Calendar . MINUTE );
918+ endTimePicker = new com .mirth .connect .client .ui .components .MirthTimePicker (( use24hourNotation ? "HH:mm" : "hh:mm aa" ), Calendar . MINUTE );
914919 filterButton = new javax .swing .JButton ();
915920 advSearchButton = new javax .swing .JButton ();
916921 levelBoxInformation = new com .mirth .connect .client .ui .components .MirthCheckBox ();
@@ -969,6 +974,17 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
969974 }
970975 });
971976
977+ hourNotation24 .setSelected (use24hourNotation );
978+ hourNotation24 .setBackground (new java .awt .Color (255 , 255 , 255 ));
979+ hourNotation24 .setText ("24 hour" );
980+ hourNotation24 .setToolTipText ("Use 24 hour notation" );
981+ hourNotation24 .setFont (new java .awt .Font ("Lucida Grande" , 0 , 11 )); // NOI18N
982+ hourNotation24 .addItemListener (new java .awt .event .ItemListener () {
983+ public void itemStateChanged (java .awt .event .ItemEvent evt ) {
984+ hourNotation24ItemStateChanged (evt );
985+ }
986+ });
987+
972988 lastSearchCriteriaPane .setBorder (null );
973989 lastSearchCriteriaPane .setHorizontalScrollBarPolicy (javax .swing .ScrollPaneConstants .HORIZONTAL_SCROLLBAR_NEVER );
974990
@@ -1108,7 +1124,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
11081124 .addPreferredGap (javax .swing .LayoutStyle .ComponentPlacement .RELATED )
11091125 .addGroup (layout .createParallelGroup (javax .swing .GroupLayout .Alignment .LEADING )
11101126 .addGroup (layout .createSequentialGroup ()
1111- .addComponent (allDayCheckBox , javax .swing .GroupLayout .PREFERRED_SIZE , javax .swing .GroupLayout .DEFAULT_SIZE , javax .swing .GroupLayout .PREFERRED_SIZE )
1127+ .addGroup (layout .createParallelGroup (javax .swing .GroupLayout .Alignment .LEADING , false )
1128+ .addComponent (allDayCheckBox , javax .swing .GroupLayout .PREFERRED_SIZE , javax .swing .GroupLayout .DEFAULT_SIZE , javax .swing .GroupLayout .PREFERRED_SIZE )
1129+ .addComponent (hourNotation24 , javax .swing .GroupLayout .PREFERRED_SIZE , javax .swing .GroupLayout .DEFAULT_SIZE , javax .swing .GroupLayout .PREFERRED_SIZE ))
11121130 .addGap (19 , 19 , 19 )
11131131 .addGroup (layout .createParallelGroup (javax .swing .GroupLayout .Alignment .LEADING , false )
11141132 .addComponent (levelBoxInformation , javax .swing .GroupLayout .DEFAULT_SIZE , 95 , Short .MAX_VALUE )
@@ -1192,7 +1210,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
11921210 .addComponent (levelBoxInformation , javax .swing .GroupLayout .PREFERRED_SIZE , 16 , javax .swing .GroupLayout .PREFERRED_SIZE )
11931211 .addComponent (allDayCheckBox , javax .swing .GroupLayout .PREFERRED_SIZE , javax .swing .GroupLayout .DEFAULT_SIZE , javax .swing .GroupLayout .PREFERRED_SIZE ))
11941212 .addPreferredGap (javax .swing .LayoutStyle .ComponentPlacement .RELATED )
1195- .addComponent (levelBoxWarning , javax .swing .GroupLayout .PREFERRED_SIZE , 16 , javax .swing .GroupLayout .PREFERRED_SIZE )
1213+ .addGroup (layout .createParallelGroup (javax .swing .GroupLayout .Alignment .BASELINE )
1214+ .addComponent (levelBoxWarning , javax .swing .GroupLayout .PREFERRED_SIZE , 16 , javax .swing .GroupLayout .PREFERRED_SIZE )
1215+ .addComponent (hourNotation24 , javax .swing .GroupLayout .PREFERRED_SIZE , javax .swing .GroupLayout .DEFAULT_SIZE , javax .swing .GroupLayout .PREFERRED_SIZE ))
11961216 .addPreferredGap (javax .swing .LayoutStyle .ComponentPlacement .RELATED )
11971217 .addComponent (levelBoxError , javax .swing .GroupLayout .PREFERRED_SIZE , 16 , javax .swing .GroupLayout .PREFERRED_SIZE ))
11981218 .addGroup (layout .createSequentialGroup ()
@@ -1212,6 +1232,12 @@ private void allDayCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GE
12121232 endTimePicker .setEnabled (endDatePicker .getDate () != null && !allDayCheckBox .isSelected ());
12131233 }//GEN-LAST:event_allDayCheckBoxActionPerformed
12141234
1235+ private void hourNotation24ItemStateChanged (java .awt .event .ItemEvent evt ) {
1236+ use24hourNotation = hourNotation24 .isSelected ();
1237+ startTimePicker .setFormatter (use24hourNotation ? "HH:mm" : "hh:mm aa" );
1238+ endTimePicker .setFormatter (use24hourNotation ? "HH:mm" : "hh:mm aa" );
1239+ }//GEN-LAST:event_hourNotation24ItemStateChanged
1240+
12151241 private void nextPageButtonActionPerformed (java .awt .event .ActionEvent evt ) {//GEN-FIRST:event_nextPageButtonActionPerformed
12161242 loadPageNumber (events .getPageNumber () + 1 );
12171243 }//GEN-LAST:event_nextPageButtonActionPerformed
@@ -1289,6 +1315,7 @@ private void advSearchButtonActionPerformed(java.awt.event.ActionEvent evt) {//G
12891315 // Variables declaration - do not modify//GEN-BEGIN:variables
12901316 private javax .swing .JButton advSearchButton ;
12911317 private com .mirth .connect .client .ui .components .MirthCheckBox allDayCheckBox ;
1318+ private com .mirth .connect .client .ui .components .MirthCheckBox hourNotation24 ;
12921319 private com .mirth .connect .client .ui .components .MirthButton countButton ;
12931320 private com .mirth .connect .client .ui .components .MirthDatePicker endDatePicker ;
12941321 private com .mirth .connect .client .ui .components .MirthTimePicker endTimePicker ;
0 commit comments