Skip to content

Commit 9df1a8f

Browse files
committed
default 24 hour notation for search criteria
Signed-off-by: Richard Ogin <rogin@users.noreply.github.com>
1 parent 7c53aef commit 9df1a8f

5 files changed

Lines changed: 110 additions & 15 deletions

File tree

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="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="hourNotation24ItemStateChanged"/>
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: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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;

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="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="hourNotation24ItemStateChanged"/>
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)