Skip to content

Commit 7e46aec

Browse files
committed
Adding the possibility to use 24h notation in the search filter of the message browser and the event browser.
1 parent 7ecf54b commit 7e46aec

File tree

5 files changed

+112
-15
lines changed

5 files changed

+112
-15
lines changed

client/src/com/mirth/connect/client/ui/browsers/event/EventBrowser.form

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<Group type="103" groupAlignment="0" attributes="0">
5656
<Group type="102" attributes="0">
5757
<Component id="allDayCheckBox" min="-2" max="-2" attributes="0"/>
58+
<Component id="hourNotation24" min="-2" max="-2" attributes="0"/>
5859
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
5960
<Group type="103" groupAlignment="0" max="-2" attributes="0">
6061
<Component id="levelBoxInformation" alignment="0" pref="95" max="32767" attributes="0"/>
@@ -163,7 +164,10 @@
163164
<Component id="allDayCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
164165
</Group>
165166
<EmptySpace max="-2" attributes="0"/>
166-
<Component id="levelBoxWarning" min="-2" pref="16" max="-2" attributes="0"/>
167+
<Group type="103" groupAlignment="3" attributes="0">
168+
<Component id="levelBoxWarning" min="-2" pref="16" max="-2" attributes="0"/>
169+
<Component id="hourNotation24" alignment="3" min="-2" max="-2" attributes="0"/>
170+
</Group>
167171
<EmptySpace max="-2" attributes="0"/>
168172
<Component id="levelBoxError" pref="16" max="-2" attributes="0"/>
169173
</Group>
@@ -287,6 +291,20 @@
287291
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="allDayCheckBoxActionPerformed"/>
288292
</Events>
289293
</Component>
294+
<Component class="com.mirth.connect.client.ui.components.MirthCheckBox" name="hourNotation24">
295+
<Properties>
296+
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
297+
<Color blue="ff" green="ff" red="ff" type="rgb"/>
298+
</Property>
299+
<Property name="text" type="java.lang.String" value="24 hour"/>
300+
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
301+
<Font name="Lucida Grande" size="11" style="0"/>
302+
</Property>
303+
</Properties>
304+
<Events>
305+
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="hourNotation24ActionPerformed"/>
306+
</Events>
307+
</Component>
290308
<Container class="javax.swing.JScrollPane" name="lastSearchCriteriaPane">
291309
<Properties>
292310
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">

client/src/com/mirth/connect/client/ui/browsers/event/EventBrowser.java

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public class EventBrowser extends javax.swing.JPanel {
9595
private Map<Integer, String> userMapById = new LinkedHashMap<Integer, String>();
9696
private SwingWorker<Void, Void> worker;
9797

98+
private Boolean use24hourNotation = true;
9899
/**
99100
* Constructs the new event browser and sets up its default information/layout.
100101
*/
@@ -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,16 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
969974
}
970975
});
971976

977+
hourNotation24.setBackground(new java.awt.Color(255, 255, 255));
978+
hourNotation24.setText("24 hour");
979+
hourNotation24.setToolTipText("Use 24 hour notation");
980+
hourNotation24.setFont(new java.awt.Font("Lucida Grande", 0, 11)); // NOI18N
981+
hourNotation24.addActionListener(new java.awt.event.ActionListener() {
982+
public void actionPerformed(java.awt.event.ActionEvent evt) {
983+
hourNotation24ActionPerformed(evt);
984+
}
985+
});
986+
972987
lastSearchCriteriaPane.setBorder(null);
973988
lastSearchCriteriaPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
974989

@@ -1108,7 +1123,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
11081123
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
11091124
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
11101125
.addGroup(layout.createSequentialGroup()
1111-
.addComponent(allDayCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1126+
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
1127+
.addComponent(allDayCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1128+
.addComponent(hourNotation24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
11121129
.addGap(19, 19, 19)
11131130
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
11141131
.addComponent(levelBoxInformation, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE)
@@ -1192,7 +1209,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
11921209
.addComponent(levelBoxInformation, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
11931210
.addComponent(allDayCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
11941211
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1195-
.addComponent(levelBoxWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
1212+
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
1213+
.addComponent(levelBoxWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
1214+
.addComponent(hourNotation24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
11961215
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
11971216
.addComponent(levelBoxError, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
11981217
.addGroup(layout.createSequentialGroup()
@@ -1212,6 +1231,12 @@ private void allDayCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GE
12121231
endTimePicker.setEnabled(endDatePicker.getDate() != null && !allDayCheckBox.isSelected());
12131232
}//GEN-LAST:event_allDayCheckBoxActionPerformed
12141233

1234+
private void hourNotation24ActionPerformed(java.awt.event.ActionEvent evt) {
1235+
use24hourNotation = hourNotation24.isSelected();
1236+
startTimePicker.setFormatter((use24hourNotation ? "HH:mm" : "hh:mm aa"));
1237+
endTimePicker.setFormatter((use24hourNotation ? "HH:mm" : "hh:mm aa"));
1238+
}
1239+
12151240
private void nextPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextPageButtonActionPerformed
12161241
loadPageNumber(events.getPageNumber() + 1);
12171242
}//GEN-LAST:event_nextPageButtonActionPerformed
@@ -1289,6 +1314,7 @@ private void advSearchButtonActionPerformed(java.awt.event.ActionEvent evt) {//G
12891314
// Variables declaration - do not modify//GEN-BEGIN:variables
12901315
private javax.swing.JButton advSearchButton;
12911316
private com.mirth.connect.client.ui.components.MirthCheckBox allDayCheckBox;
1317+
private com.mirth.connect.client.ui.components.MirthCheckBox hourNotation24;
12921318
private com.mirth.connect.client.ui.components.MirthButton countButton;
12931319
private com.mirth.connect.client.ui.components.MirthDatePicker endDatePicker;
12941320
private com.mirth.connect.client.ui.components.MirthTimePicker endTimePicker;

client/src/com/mirth/connect/client/ui/browsers/message/MessageBrowser.form

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,7 @@
838838
<EmptySpace max="-2" attributes="0"/>
839839
<Group type="103" groupAlignment="0" attributes="0">
840840
<Component id="allDayCheckBox" min="-2" max="-2" attributes="0"/>
841+
<Component id="hourNotation24" min="-2" max="-2" attributes="0"/>
841842
<Component id="filterButton" alignment="0" min="-2" pref="63" max="-2" attributes="0"/>
842843
<Component id="regexTextSearchCheckBox" min="-2" max="-2" attributes="0"/>
843844
</Group>
@@ -954,7 +955,10 @@
954955
<Component id="allDayCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
955956
</Group>
956957
<EmptySpace max="-2" attributes="0"/>
957-
<Component id="statusBoxTransformed" min="-2" pref="16" max="-2" attributes="0"/>
958+
<Group type="103" groupAlignment="3" attributes="0">
959+
<Component id="statusBoxTransformed" min="-2" pref="16" max="-2" attributes="0"/>
960+
<Component id="hourNotation24" alignment="3" min="-2" max="-2" attributes="0"/>
961+
</Group>
958962
<EmptySpace max="-2" attributes="0"/>
959963
<Component id="statusBoxFiltered" pref="16" max="-2" attributes="0"/>
960964
<EmptySpace max="-2" attributes="0"/>
@@ -1237,6 +1241,20 @@
12371241
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="allDayCheckBoxActionPerformed"/>
12381242
</Events>
12391243
</Component>
1244+
<Component class="com.mirth.connect.client.ui.components.MirthCheckBox" name="hourNotation24">
1245+
<Properties>
1246+
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
1247+
<Color blue="ff" green="ff" red="ff" type="rgb"/>
1248+
</Property>
1249+
<Property name="text" type="java.lang.String" value="24 hour"/>
1250+
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
1251+
<Font name="Lucida Grande" size="11" style="0"/>
1252+
</Property>
1253+
</Properties>
1254+
<Events>
1255+
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="hourNotation24ActionPerformed"/>
1256+
</Events>
1257+
</Component>
12401258
<Component class="com.mirth.connect.client.ui.components.MirthDatePicker" name="mirthDatePicker2">
12411259
</Component>
12421260
<Component class="javax.swing.JButton" name="nextPageButton">

0 commit comments

Comments
 (0)