Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default 24 hour notation for search criteria #5989

Open
wants to merge 5 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="allDayCheckBox" min="-2" max="-2" attributes="0"/>
<Component id="hourNotation24" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="levelBoxInformation" alignment="0" pref="95" max="32767" attributes="0"/>
Expand Down Expand Up @@ -163,7 +164,10 @@
<Component id="allDayCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="levelBoxWarning" min="-2" pref="16" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="levelBoxWarning" min="-2" pref="16" max="-2" attributes="0"/>
<Component id="hourNotation24" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="levelBoxError" pref="16" max="-2" attributes="0"/>
</Group>
Expand Down Expand Up @@ -287,6 +291,20 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="allDayCheckBoxActionPerformed"/>
</Events>
</Component>
<Component class="com.mirth.connect.client.ui.components.MirthCheckBox" name="hourNotation24">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="24 hour"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="11" style="0"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="hourNotation24ActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JScrollPane" name="lastSearchCriteriaPane">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public class EventBrowser extends javax.swing.JPanel {
private Map<Integer, String> userMapById = new LinkedHashMap<Integer, String>();
private SwingWorker<Void, Void> worker;

private Boolean use24hourNotation = true;
/**
* Constructs the new event browser and sets up its default information/layout.
*/
Expand Down Expand Up @@ -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);
}
});

Expand All @@ -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);
}
});

Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,7 @@
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="allDayCheckBox" min="-2" max="-2" attributes="0"/>
<Component id="hourNotation24" min="-2" max="-2" attributes="0"/>
<Component id="filterButton" alignment="0" min="-2" pref="63" max="-2" attributes="0"/>
<Component id="regexTextSearchCheckBox" min="-2" max="-2" attributes="0"/>
</Group>
Expand Down Expand Up @@ -954,7 +955,10 @@
<Component id="allDayCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="statusBoxTransformed" min="-2" pref="16" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="statusBoxTransformed" min="-2" pref="16" max="-2" attributes="0"/>
<Component id="hourNotation24" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="statusBoxFiltered" pref="16" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
Expand Down Expand Up @@ -1237,6 +1241,20 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="allDayCheckBoxActionPerformed"/>
</Events>
</Component>
<Component class="com.mirth.connect.client.ui.components.MirthCheckBox" name="hourNotation24">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" value="24 hour"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="11" style="0"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="hourNotation24ActionPerformed"/>
</Events>
</Component>
<Component class="com.mirth.connect.client.ui.components.MirthDatePicker" name="mirthDatePicker2">
</Component>
<Component class="javax.swing.JButton" name="nextPageButton">
Expand Down
Loading