diff --git a/client/src/com/mirth/connect/client/ui/browsers/event/EventBrowser.form b/client/src/com/mirth/connect/client/ui/browsers/event/EventBrowser.form index 2bfa3905e..e73ec9cbd 100644 --- a/client/src/com/mirth/connect/client/ui/browsers/event/EventBrowser.form +++ b/client/src/com/mirth/connect/client/ui/browsers/event/EventBrowser.form @@ -55,6 +55,7 @@ + @@ -163,7 +164,10 @@ - + + + + @@ -287,6 +291,20 @@ + + + + + + + + + + + + + + diff --git a/client/src/com/mirth/connect/client/ui/browsers/event/EventBrowser.java b/client/src/com/mirth/connect/client/ui/browsers/event/EventBrowser.java index 984145220..fcb772481 100644 --- a/client/src/com/mirth/connect/client/ui/browsers/event/EventBrowser.java +++ b/client/src/com/mirth/connect/client/ui/browsers/event/EventBrowser.java @@ -95,6 +95,7 @@ public class EventBrowser extends javax.swing.JPanel { private Map userMapById = new LinkedHashMap(); private SwingWorker worker; + private Boolean use24hourNotation = true; /** * Constructs the new event browser and sets up its default information/layout. */ @@ -138,6 +139,7 @@ public void mouseReleased(java.awt.event.MouseEvent evt) { public void propertyChange(PropertyChangeEvent arg0) { allDayCheckBox.setEnabled(startDatePicker.getDate() != null || endDatePicker.getDate() != null); startTimePicker.setEnabled(startDatePicker.getDate() != null && !allDayCheckBox.isSelected()); + hourNotation24.setEnabled(startDatePicker.getDate() != null || endDatePicker.getDate() != null); } }); @@ -146,6 +148,7 @@ public void propertyChange(PropertyChangeEvent arg0) { public void propertyChange(PropertyChangeEvent arg0) { allDayCheckBox.setEnabled(startDatePicker.getDate() != null || endDatePicker.getDate() != null); endTimePicker.setEnabled(endDatePicker.getDate() != null && !allDayCheckBox.isSelected()); + hourNotation24.setEnabled(startDatePicker.getDate() != null || endDatePicker.getDate() != null); } }); @@ -207,7 +210,7 @@ public void loadNew(String eventNameFilter) { } private Calendar getCalendar(MirthDatePicker datePicker, MirthTimePicker timePicker) throws ParseException { - DateFormatter timeFormatter = new DateFormatter(new SimpleDateFormat("hh:mm aa")); + DateFormatter timeFormatter = new DateFormatter(new SimpleDateFormat((use24hourNotation ? "HH:mm" : "hh:mm aa"))); Date date = datePicker.getDate(); String time = timePicker.getDate(); @@ -582,6 +585,7 @@ public void resetSearchCriteria() { endDatePicker.setDate(null); nameField.setText(""); allDayCheckBox.setSelected(false); + hourNotation24.setSelected(true); levelBoxInformation.setSelected(false); levelBoxWarning.setSelected(false); levelBoxError.setSelected(false); @@ -892,6 +896,7 @@ private void initComponents() { eventAttributesTable = null; resetButton = new javax.swing.JButton(); allDayCheckBox = new com.mirth.connect.client.ui.components.MirthCheckBox(); + hourNotation24 = new com.mirth.connect.client.ui.components.MirthCheckBox(); lastSearchCriteriaPane = new javax.swing.JScrollPane(); lastSearchCriteria = new javax.swing.JTextArea(); nextPageButton = new javax.swing.JButton(); @@ -909,8 +914,8 @@ private void initComponents() { endDatePicker = new com.mirth.connect.client.ui.components.MirthDatePicker(); startDatePicker = new com.mirth.connect.client.ui.components.MirthDatePicker(); nameField = new javax.swing.JTextField(); - startTimePicker = new com.mirth.connect.client.ui.components.MirthTimePicker(); - endTimePicker = new com.mirth.connect.client.ui.components.MirthTimePicker(); + startTimePicker = new com.mirth.connect.client.ui.components.MirthTimePicker((use24hourNotation ? "HH:mm" : "hh:mm aa"), Calendar.MINUTE); + endTimePicker = new com.mirth.connect.client.ui.components.MirthTimePicker((use24hourNotation ? "HH:mm" : "hh:mm aa"), Calendar.MINUTE); filterButton = new javax.swing.JButton(); advSearchButton = new javax.swing.JButton(); levelBoxInformation = new com.mirth.connect.client.ui.components.MirthCheckBox(); @@ -969,6 +974,16 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); + hourNotation24.setBackground(new java.awt.Color(255, 255, 255)); + hourNotation24.setText("24 hour"); + hourNotation24.setToolTipText("Use 24 hour notation"); + hourNotation24.setFont(new java.awt.Font("Lucida Grande", 0, 11)); // NOI18N + hourNotation24.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + hourNotation24ActionPerformed(evt); + } + }); + lastSearchCriteriaPane.setBorder(null); lastSearchCriteriaPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); @@ -1108,7 +1123,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addComponent(allDayCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(allDayCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(hourNotation24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(19, 19, 19) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(levelBoxInformation, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE) @@ -1192,7 +1209,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(levelBoxInformation, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(allDayCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(levelBoxWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(levelBoxWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(hourNotation24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(levelBoxError, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() @@ -1212,6 +1231,12 @@ private void allDayCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GE endTimePicker.setEnabled(endDatePicker.getDate() != null && !allDayCheckBox.isSelected()); }//GEN-LAST:event_allDayCheckBoxActionPerformed + private void hourNotation24ActionPerformed(java.awt.event.ActionEvent evt) { + use24hourNotation = hourNotation24.isSelected(); + startTimePicker.setFormatter((use24hourNotation ? "HH:mm" : "hh:mm aa")); + endTimePicker.setFormatter((use24hourNotation ? "HH:mm" : "hh:mm aa")); + } + private void nextPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextPageButtonActionPerformed loadPageNumber(events.getPageNumber() + 1); }//GEN-LAST:event_nextPageButtonActionPerformed @@ -1289,6 +1314,7 @@ private void advSearchButtonActionPerformed(java.awt.event.ActionEvent evt) {//G // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton advSearchButton; private com.mirth.connect.client.ui.components.MirthCheckBox allDayCheckBox; + private com.mirth.connect.client.ui.components.MirthCheckBox hourNotation24; private com.mirth.connect.client.ui.components.MirthButton countButton; private com.mirth.connect.client.ui.components.MirthDatePicker endDatePicker; private com.mirth.connect.client.ui.components.MirthTimePicker endTimePicker; diff --git a/client/src/com/mirth/connect/client/ui/browsers/message/MessageBrowser.form b/client/src/com/mirth/connect/client/ui/browsers/message/MessageBrowser.form index edaeeeac2..c24d9ee57 100644 --- a/client/src/com/mirth/connect/client/ui/browsers/message/MessageBrowser.form +++ b/client/src/com/mirth/connect/client/ui/browsers/message/MessageBrowser.form @@ -838,6 +838,7 @@ + @@ -954,7 +955,10 @@ - + + + + @@ -1237,6 +1241,20 @@ + + + + + + + + + + + + + + diff --git a/client/src/com/mirth/connect/client/ui/browsers/message/MessageBrowser.java b/client/src/com/mirth/connect/client/ui/browsers/message/MessageBrowser.java index 72b06293b..cca2e4c20 100644 --- a/client/src/com/mirth/connect/client/ui/browsers/message/MessageBrowser.java +++ b/client/src/com/mirth/connect/client/ui/browsers/message/MessageBrowser.java @@ -172,6 +172,9 @@ public class MessageBrowser extends javax.swing.JPanel { private List selectedMetaDataIds; + + private Boolean use24hourNotation = true; + /** * Constructs the new message browser and sets up its default information/layout */ @@ -250,6 +253,7 @@ public void actionPerformed(ActionEvent e) { public void propertyChange(PropertyChangeEvent arg0) { allDayCheckBox.setEnabled(mirthDatePicker1.getDate() != null || mirthDatePicker2.getDate() != null); mirthTimePicker1.setEnabled(mirthDatePicker1.getDate() != null && !allDayCheckBox.isSelected()); + hourNotation24.setEnabled(mirthDatePicker1.getDate() != null || mirthDatePicker2.getDate() != null); } }); @@ -258,6 +262,7 @@ public void propertyChange(PropertyChangeEvent arg0) { public void propertyChange(PropertyChangeEvent arg0) { allDayCheckBox.setEnabled(mirthDatePicker1.getDate() != null || mirthDatePicker2.getDate() != null); mirthTimePicker2.setEnabled(mirthDatePicker2.getDate() != null && !allDayCheckBox.isSelected()); + hourNotation24.setEnabled(mirthDatePicker1.getDate() != null || mirthDatePicker2.getDate() != null); } }); @@ -423,6 +428,7 @@ public void resetSearchCriteria() { textSearchField.setText(""); regexTextSearchCheckBox.setSelected(false); allDayCheckBox.setSelected(false); + hourNotation24.setSelected(true); statusBoxReceived.setSelected(false); statusBoxTransformed.setSelected(false); statusBoxFiltered.setSelected(false); @@ -499,7 +505,7 @@ public int getPageSize() { } private Calendar getCalendar(MirthDatePicker datePicker, MirthTimePicker timePicker) throws ParseException { - DateFormatter timeFormatter = new DateFormatter(new SimpleDateFormat("hh:mm aa")); + DateFormatter timeFormatter = new DateFormatter(new SimpleDateFormat((use24hourNotation ? "HH:mm" : "hh:mm aa"))); Date date = datePicker.getDate(); String time = timePicker.getDate(); @@ -2381,11 +2387,12 @@ private void initComponents() { advSearchButton = new javax.swing.JButton(); pageSizeField = new com.mirth.connect.client.ui.components.MirthTextField(); statusBoxError = new com.mirth.connect.client.ui.components.MirthCheckBox(); - mirthTimePicker2 = new com.mirth.connect.client.ui.components.MirthTimePicker(); + mirthTimePicker2 = new com.mirth.connect.client.ui.components.MirthTimePicker((use24hourNotation ? "HH:mm" : "hh:mm aa"), Calendar.MINUTE); statusBoxReceived = new com.mirth.connect.client.ui.components.MirthCheckBox(); pageGoButton = new javax.swing.JButton(); statusBoxTransformed = new com.mirth.connect.client.ui.components.MirthCheckBox(); - mirthTimePicker1 = new com.mirth.connect.client.ui.components.MirthTimePicker(); + mirthTimePicker1 = new com.mirth.connect.client.ui.components.MirthTimePicker((use24hourNotation ? "HH:mm" : "hh:mm aa"), Calendar.MINUTE); + hourNotation24 = new com.mirth.connect.client.ui.components.MirthCheckBox(); jLabel3 = new javax.swing.JLabel(); allDayCheckBox = new com.mirth.connect.client.ui.components.MirthCheckBox(); mirthDatePicker2 = new com.mirth.connect.client.ui.components.MirthDatePicker(); @@ -2917,6 +2924,16 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { regexTextSearchCheckBox.setText("Regex"); regexTextSearchCheckBox.setToolTipText(" Search all message content for a match to the regular expression pattern.
Regex matching could be a very costly operation and should be used with
caution, specially with large amount of messages. Any message content
that was encrypted by this channel will not be searchable. Only supported
on PostgreSQL, Oracle and MySQL databases. "); + hourNotation24.setBackground(new java.awt.Color(255, 255, 255)); + hourNotation24.setText("24 hour"); + hourNotation24.setToolTipText("Use 24 hour notation"); + hourNotation24.setFont(new java.awt.Font("Lucida Grande", 0, 11)); // NOI18N + hourNotation24.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + hourNotation24ActionPerformed(evt); + } + }); + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( @@ -2948,8 +2965,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(textSearchField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 218, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(allDayCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(filterButton, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(allDayCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(hourNotation24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(filterButton, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(regexTextSearchCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -3044,7 +3062,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(statusBoxReceived, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(allDayCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(statusBoxTransformed, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(statusBoxTransformed, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(hourNotation24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(statusBoxFiltered, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -3191,6 +3211,12 @@ private void allDayCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GE mirthTimePicker2.setEnabled(mirthDatePicker2.getDate() != null && !allDayCheckBox.isSelected()); }//GEN-LAST:event_allDayCheckBoxActionPerformed + private void hourNotation24ActionPerformed(java.awt.event.ActionEvent evt) { + use24hourNotation = hourNotation24.isSelected(); + mirthTimePicker1.setFormatter((use24hourNotation ? "HH:mm" : "hh:mm aa")); + mirthTimePicker2.setFormatter((use24hourNotation ? "HH:mm" : "hh:mm aa")); + } + private void pageGoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pageGoButtonActionPerformed jumpToPageNumber(); }//GEN-LAST:event_pageGoButtonActionPerformed @@ -3269,6 +3295,8 @@ private void textSearchFieldActionPerformed(java.awt.event.ActionEvent evt) {//G private javax.swing.JScrollPane messageScrollPane; protected com.mirth.connect.client.ui.components.MirthTreeTable messageTreeTable; private javax.swing.ButtonGroup messagesGroup; + + private com.mirth.connect.client.ui.components.MirthCheckBox hourNotation24; private com.mirth.connect.client.ui.components.MirthDatePicker mirthDatePicker1; private com.mirth.connect.client.ui.components.MirthDatePicker mirthDatePicker2; private com.mirth.connect.client.ui.components.MirthTimePicker mirthTimePicker1; diff --git a/client/src/com/mirth/connect/client/ui/components/MirthTimePicker.java b/client/src/com/mirth/connect/client/ui/components/MirthTimePicker.java index 3693501fe..8d1dde662 100644 --- a/client/src/com/mirth/connect/client/ui/components/MirthTimePicker.java +++ b/client/src/com/mirth/connect/client/ui/components/MirthTimePicker.java @@ -49,7 +49,7 @@ public MirthTimePicker(String format, int accuracy) { public void init(String format, int accuracy) { this.parent = PlatformUI.MIRTH_FRAME; - SimpleDateFormat dateFormat = new SimpleDateFormat(format); + //SimpleDateFormat dateFormat = new SimpleDateFormat(format); GregorianCalendar calendar = new GregorianCalendar(); Date now = calendar.getTime(); SpinnerDateModel dateModel = new SpinnerDateModel(now, null, null, accuracy); @@ -70,10 +70,11 @@ public void keyPressed(KeyEvent e) { public void keyReleased(KeyEvent e) {} }); - DefaultFormatterFactory factory = (DefaultFormatterFactory) tf.getFormatterFactory(); + /*DefaultFormatterFactory factory = (DefaultFormatterFactory) tf.getFormatterFactory(); formatter = (DateFormatter) factory.getDefaultFormatter(); formatter.setFormat(dateFormat); - fireStateChanged(); + fireStateChanged();*/ + setFormatter(format); this.addChangeListener(new ChangeListener() { @@ -85,6 +86,15 @@ public void stateChanged(ChangeEvent event) { }); } + public void setFormatter(String formatString) { + SimpleDateFormat dateFormat = new SimpleDateFormat(formatString); + JFormattedTextField tf = ((JSpinner.DefaultEditor) getEditor()).getTextField(); + DefaultFormatterFactory factory = (DefaultFormatterFactory) tf.getFormatterFactory(); + formatter = (DateFormatter) factory.getDefaultFormatter(); + formatter.setFormat(dateFormat); + fireStateChanged(); + } + public void setSaveEnabled(boolean saveEnabled) { this.saveEnabled = saveEnabled; }