mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
3219: Replace JCalendarButton with LGoodDatePick for DateSearchPanel
This commit is contained in:
parent
551cdfd03b
commit
e442bf58b0
@ -22,5 +22,6 @@
|
|||||||
|
|
||||||
<dependency conf="core->default" org="org.apache.commons" name="commons-dbcp2" rev="2.1.1"/>
|
<dependency conf="core->default" org="org.apache.commons" name="commons-dbcp2" rev="2.1.1"/>
|
||||||
<dependency conf="core->default" org="org.apache.commons" name="commons-pool2" rev="2.4.2"/>
|
<dependency conf="core->default" org="org.apache.commons" name="commons-pool2" rev="2.4.2"/>
|
||||||
|
<dependency org="com.github.lgooddatepicker" name="LGoodDatePicker" rev="10.3.1"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</ivy-module>
|
</ivy-module>
|
||||||
|
@ -6,6 +6,7 @@ file.reference.commons-pool2-2.4.2.jar=release\\modules\\ext\\commons-pool2-2.4.
|
|||||||
file.reference.jdom-2.0.5-contrib.jar=release/modules/ext/jdom-2.0.5-contrib.jar
|
file.reference.jdom-2.0.5-contrib.jar=release/modules/ext/jdom-2.0.5-contrib.jar
|
||||||
file.reference.jdom-2.0.5.jar=release/modules/ext/jdom-2.0.5.jar
|
file.reference.jdom-2.0.5.jar=release/modules/ext/jdom-2.0.5.jar
|
||||||
file.reference.jython-standalone-2.7.0.jar=release/modules/ext/jython-standalone-2.7.0.jar
|
file.reference.jython-standalone-2.7.0.jar=release/modules/ext/jython-standalone-2.7.0.jar
|
||||||
|
file.reference.LGoodDatePicker-10.3.1.jar=release/modules/ext/LGoodDatePicker-10.3.1.jar
|
||||||
file.reference.mchange-commons-java-0.2.9.jar=release/modules/ext/mchange-commons-java-0.2.9.jar
|
file.reference.mchange-commons-java-0.2.9.jar=release/modules/ext/mchange-commons-java-0.2.9.jar
|
||||||
file.reference.metadata-extractor-2.9.1.jar=release/modules/ext/metadata-extractor-2.9.1.jar
|
file.reference.metadata-extractor-2.9.1.jar=release/modules/ext/metadata-extractor-2.9.1.jar
|
||||||
file.reference.postgresql-9.4.1211.jre7.jar=release/modules/ext/postgresql-9.4.1211.jre7.jar
|
file.reference.postgresql-9.4.1211.jre7.jar=release/modules/ext/postgresql-9.4.1211.jre7.jar
|
||||||
@ -25,10 +26,12 @@ file.reference.curator-recipes-2.8.0.jar=release/modules/ext/curator-recipes-2.8
|
|||||||
file.reference.zookeeper-3.4.6.jar=release/modules/ext/zookeeper-3.4.6.jar
|
file.reference.zookeeper-3.4.6.jar=release/modules/ext/zookeeper-3.4.6.jar
|
||||||
javac.source=1.8
|
javac.source=1.8
|
||||||
javac.compilerargs=-Xlint -Xlint:-serial
|
javac.compilerargs=-Xlint -Xlint:-serial
|
||||||
|
javadoc.reference.LGoodDatePicker-10.3.1.jar=release/modules/ext/LGoodDatePicker-10.3.1-javadoc.jar
|
||||||
license.file=../LICENSE-2.0.txt
|
license.file=../LICENSE-2.0.txt
|
||||||
nbm.homepage=http://www.sleuthkit.org/
|
nbm.homepage=http://www.sleuthkit.org/
|
||||||
nbm.module.author=Brian Carrier
|
nbm.module.author=Brian Carrier
|
||||||
nbm.needs.restart=true
|
nbm.needs.restart=true
|
||||||
source.reference.curator-recipes-2.8.0.jar=release/modules/ext/curator-recipes-2.8.0-sources.jar
|
source.reference.curator-recipes-2.8.0.jar=release/modules/ext/curator-recipes-2.8.0-sources.jar
|
||||||
|
source.reference.LGoodDatePicker-10.3.1.jar=release/modules/ext/LGoodDatePicker-10.3.1-sources.jar
|
||||||
spec.version.base=10.9
|
spec.version.base=10.9
|
||||||
|
|
||||||
|
@ -332,6 +332,10 @@
|
|||||||
<runtime-relative-path>ext/tika-core-1.14.jar</runtime-relative-path>
|
<runtime-relative-path>ext/tika-core-1.14.jar</runtime-relative-path>
|
||||||
<binary-origin>release/modules/ext/tika-core-1.14.jar</binary-origin>
|
<binary-origin>release/modules/ext/tika-core-1.14.jar</binary-origin>
|
||||||
</class-path-extension>
|
</class-path-extension>
|
||||||
|
<class-path-extension>
|
||||||
|
<runtime-relative-path>ext/LGoodDatePicker-10.3.1.jar</runtime-relative-path>
|
||||||
|
<binary-origin>release/modules/ext/LGoodDatePicker-10.3.1.jar</binary-origin>
|
||||||
|
</class-path-extension>
|
||||||
<class-path-extension>
|
<class-path-extension>
|
||||||
<runtime-relative-path>ext/Tsk_DataModel_PostgreSQL.jar</runtime-relative-path>
|
<runtime-relative-path>ext/Tsk_DataModel_PostgreSQL.jar</runtime-relative-path>
|
||||||
<binary-origin>release/modules/ext/Tsk_DataModel_PostgreSQL.jar</binary-origin>
|
<binary-origin>release/modules/ext/Tsk_DataModel_PostgreSQL.jar</binary-origin>
|
||||||
|
@ -12,11 +12,7 @@ DateSearchPanel.createdCheckBox.text=Created
|
|||||||
DateSearchPanel.accessedCheckBox.text=Accessed
|
DateSearchPanel.accessedCheckBox.text=Accessed
|
||||||
DateSearchPanel.changedCheckBox.text=Changed
|
DateSearchPanel.changedCheckBox.text=Changed
|
||||||
DateSearchPanel.modifiedCheckBox.text=Modified
|
DateSearchPanel.modifiedCheckBox.text=Modified
|
||||||
DateSearchPanel.dateToButtonCalendar.text=
|
|
||||||
DateSearchPanel.dateToTextField.text=
|
|
||||||
DateSearchPanel.jLabel1.text=to
|
DateSearchPanel.jLabel1.text=to
|
||||||
DateSearchPanel.dateFromTextField.text=
|
|
||||||
DateSearchPanel.dateFromButtonCalendar.text=
|
|
||||||
NameSearchPanel.nameCheckBox.text=Name:
|
NameSearchPanel.nameCheckBox.text=Name:
|
||||||
NameSearchPanel.noteNameLabel.text=<html>*Note: Name match is case insensitive and matches any part of the file name. Regular expressions are not currently supported.</html>
|
NameSearchPanel.noteNameLabel.text=<html>*Note: Name match is case insensitive and matches any part of the file name. Regular expressions are not currently supported.</html>
|
||||||
NameSearchPanel.searchTextField.text=
|
NameSearchPanel.searchTextField.text=
|
||||||
|
@ -82,7 +82,7 @@ class DateSearchFilter extends AbstractFileSearchFilter<DateSearchPanel> {
|
|||||||
|
|
||||||
// convert the date from the selected timezone to get the GMT
|
// convert the date from the selected timezone to get the GMT
|
||||||
long fromDate = 0;
|
long fromDate = 0;
|
||||||
String startDateValue = panel.getDateFromTextField().getText();
|
String startDateValue = panel.getFromDate();
|
||||||
Calendar startDate = getCalendarDate(startDateValue);
|
Calendar startDate = getCalendarDate(startDateValue);
|
||||||
if (!startDateValue.isEmpty()) {
|
if (!startDateValue.isEmpty()) {
|
||||||
if (startDate != null) {
|
if (startDate != null) {
|
||||||
@ -91,7 +91,7 @@ class DateSearchFilter extends AbstractFileSearchFilter<DateSearchPanel> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
long toDate = 0;
|
long toDate = 0;
|
||||||
String endDateValue = panel.getDateToTextField().getText();
|
String endDateValue = panel.getToDate();
|
||||||
Calendar endDate = getCalendarDate(endDateValue);
|
Calendar endDate = getCalendarDate(endDateValue);
|
||||||
if (!endDateValue.isEmpty()) {
|
if (!endDateValue.isEmpty()) {
|
||||||
if (endDate != null) {
|
if (endDate != null) {
|
||||||
@ -199,7 +199,7 @@ class DateSearchFilter extends AbstractFileSearchFilter<DateSearchPanel> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addActionListener(ActionListener l) {
|
public void addActionListener(ActionListener l) {
|
||||||
getComponent().addActionListener(l);
|
getComponent().addDateChangeListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -210,8 +210,8 @@ class DateSearchFilter extends AbstractFileSearchFilter<DateSearchPanel> {
|
|||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
|
|
||||||
DateSearchPanel panel = this.getComponent();
|
DateSearchPanel panel = this.getComponent();
|
||||||
Calendar startDate = getCalendarDate(panel.getDateFromTextField().getText());
|
Calendar startDate = getCalendarDate(panel.getFromDate());
|
||||||
Calendar endDate = getCalendarDate(panel.getDateToTextField().getText());
|
Calendar endDate = getCalendarDate(panel.getToDate());
|
||||||
|
|
||||||
if ((startDate != null && startDate.after(endDate)) || (endDate != null && endDate.before(startDate))) {
|
if ((startDate != null && startDate.after(endDate)) || (endDate != null && endDate.before(startDate))) {
|
||||||
setLastError(Bundle.DateSearchFilter_errorMessage_endDateBeforeStartDate());
|
setLastError(Bundle.DateSearchFilter_errorMessage_endDateBeforeStartDate());
|
||||||
|
@ -55,28 +55,11 @@
|
|||||||
<DimensionLayout dim="0">
|
<DimensionLayout dim="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" attributes="0">
|
<Group type="102" attributes="0">
|
||||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="102" attributes="0">
|
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="dateCheckBox" min="-2" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="dateFromTextField" min="-2" pref="92" max="-2" attributes="0"/>
|
<EmptySpace max="32767" attributes="0"/>
|
||||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
|
||||||
<Component id="dateFromButtonCalendar" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
|
||||||
<Component id="dateToTextField" min="-2" pref="92" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
|
||||||
<Component id="dateToButtonCalendar" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="32767" attributes="0"/>
|
|
||||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace pref="26" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
</Group>
|
||||||
<Group type="102" alignment="1" attributes="0">
|
<Group type="102" alignment="1" attributes="0">
|
||||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||||
@ -98,27 +81,31 @@
|
|||||||
</Group>
|
</Group>
|
||||||
<EmptySpace min="-2" pref="33" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="33" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<Component id="dateCheckBox" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="32767" attributes="0"/>
|
||||||
|
<Component id="fromDatePicker" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="jLabel1" min="-2" pref="10" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
|
||||||
|
<Component id="toDatePicker" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" attributes="0">
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
<Component id="dateCheckBox" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="dateCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="dateFromTextField" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" attributes="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
<Component id="dateToButtonCalendar" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
|
<Component id="fromDatePicker" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="toDatePicker" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="dateToTextField" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Component id="dateFromButtonCalendar" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace max="32767" attributes="0"/>
|
<EmptySpace max="32767" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
@ -147,20 +134,6 @@
|
|||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
<SubComponents>
|
<SubComponents>
|
||||||
<Component class="javax.swing.JFormattedTextField" name="dateToTextField">
|
|
||||||
<Properties>
|
|
||||||
<Property name="editable" type="boolean" value="false"/>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/filesearch/Bundle.properties" key="DateSearchPanel.dateToTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="dateToTextFieldFocusLost"/>
|
|
||||||
</Events>
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new JFormattedTextField(this.dateFormat);"/>
|
|
||||||
</AuxValues>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||||
@ -207,20 +180,6 @@
|
|||||||
</Property>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JFormattedTextField" name="dateFromTextField">
|
|
||||||
<Properties>
|
|
||||||
<Property name="editable" type="boolean" value="false"/>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/filesearch/Bundle.properties" key="DateSearchPanel.dateFromTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="dateFromTextFieldFocusLost"/>
|
|
||||||
</Events>
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new JFormattedTextField(this.dateFormat);"/>
|
|
||||||
</AuxValues>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||||
@ -275,25 +234,21 @@
|
|||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="createdCheckBoxActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="createdCheckBoxActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="org.jbundle.thin.base.screen.jcalendarbutton.JCalendarButton" name="dateFromButtonCalendar">
|
<Component class="com.github.lgooddatepicker.components.DatePicker" name="fromDatePicker">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
<Property name="autoscrolls" type="boolean" value="true"/>
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/filesearch/Bundle.properties" key="DateSearchPanel.dateFromButtonCalendar.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<AuxValues>
|
||||||
<EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="dateFromPopupChanged"/>
|
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new DatePicker(fromDateSettings);"/>
|
||||||
</Events>
|
</AuxValues>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="org.jbundle.thin.base.screen.jcalendarbutton.JCalendarButton" name="dateToButtonCalendar">
|
<Component class="com.github.lgooddatepicker.components.DatePicker" name="toDatePicker">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
<Property name="autoscrolls" type="boolean" value="true"/>
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/filesearch/Bundle.properties" key="DateSearchPanel.dateToButtonCalendar.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<AuxValues>
|
||||||
<EventHandler event="propertyChange" listener="java.beans.PropertyChangeListener" parameters="java.beans.PropertyChangeEvent" handler="dateToPopupChanged"/>
|
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new DatePicker(toDateSettings);"/>
|
||||||
</Events>
|
</AuxValues>
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Form>
|
</Form>
|
||||||
|
@ -21,22 +21,25 @@ package org.sleuthkit.autopsy.filesearch;
|
|||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.ParseException;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
import javax.swing.JFormattedTextField;
|
import javax.swing.JFormattedTextField;
|
||||||
import javax.swing.JMenuItem;
|
import javax.swing.JMenuItem;
|
||||||
import javax.swing.JPopupMenu;
|
import javax.swing.JPopupMenu;
|
||||||
import javax.swing.event.DocumentEvent;
|
import com.github.lgooddatepicker.components.DatePicker;
|
||||||
import javax.swing.event.DocumentListener;
|
import com.github.lgooddatepicker.optionalusertools.PickerUtilities;
|
||||||
|
import com.github.lgooddatepicker.components.DatePickerSettings;
|
||||||
|
import com.github.lgooddatepicker.optionalusertools.DateChangeListener;
|
||||||
|
import com.github.lgooddatepicker.zinternaltools.DateChangeEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subpanel with controls for file data filtering.
|
* Subpanel with controls for file data filtering.
|
||||||
*/
|
*/
|
||||||
class DateSearchPanel extends javax.swing.JPanel {
|
class DateSearchPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
|
private final DatePickerSettings fromDateSettings = new DatePickerSettings();
|
||||||
|
private final DatePickerSettings toDateSettings = new DatePickerSettings();
|
||||||
DateFormat dateFormat;
|
DateFormat dateFormat;
|
||||||
List<String> timeZones;
|
List<String> timeZones;
|
||||||
|
|
||||||
@ -49,10 +52,11 @@ class DateSearchPanel extends javax.swing.JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void customizeComponents() {
|
private void customizeComponents() {
|
||||||
|
fromDateSettings.setFormatForDatesCommonEra(PickerUtilities.createFormatterFromPatternString("MM/dd/yyyy", fromDateSettings.getLocale()));
|
||||||
dateFromTextField.setComponentPopupMenu(rightClickMenu);
|
toDateSettings.setFormatForDatesCommonEra(PickerUtilities.createFormatterFromPatternString("MM/dd/yyyy", toDateSettings.getLocale()));
|
||||||
dateToTextField.setComponentPopupMenu(rightClickMenu);
|
fromDateSettings.setAllowKeyboardEditing(false);
|
||||||
|
toDateSettings.setAllowKeyboardEditing(false);
|
||||||
|
|
||||||
ActionListener actList = new ActionListener() {
|
ActionListener actList = new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -77,41 +81,7 @@ class DateSearchPanel extends javax.swing.JPanel {
|
|||||||
copyMenuItem.addActionListener(actList);
|
copyMenuItem.addActionListener(actList);
|
||||||
pasteMenuItem.addActionListener(actList);
|
pasteMenuItem.addActionListener(actList);
|
||||||
selectAllMenuItem.addActionListener(actList);
|
selectAllMenuItem.addActionListener(actList);
|
||||||
this.dateFromTextField.getDocument().addDocumentListener(new DocumentListener() {
|
|
||||||
@Override
|
|
||||||
public void insertUpdate(DocumentEvent e) {
|
|
||||||
firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeUpdate(DocumentEvent e) {
|
|
||||||
firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void changedUpdate(DocumentEvent e) {
|
|
||||||
firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.dateToTextField.getDocument().addDocumentListener(new DocumentListener() {
|
|
||||||
@Override
|
|
||||||
public void insertUpdate(DocumentEvent e) {
|
|
||||||
firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeUpdate(DocumentEvent e) {
|
|
||||||
firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void changedUpdate(DocumentEvent e) {
|
|
||||||
firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
this.setComponentsEnabled();
|
this.setComponentsEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,12 +101,12 @@ class DateSearchPanel extends javax.swing.JPanel {
|
|||||||
return dateCheckBox;
|
return dateCheckBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
JFormattedTextField getDateFromTextField() {
|
String getFromDate() {
|
||||||
return dateFromTextField;
|
return fromDatePicker.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
JFormattedTextField getDateToTextField() {
|
String getToDate() {
|
||||||
return dateToTextField;
|
return toDatePicker.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
JCheckBox getModifiedCheckBox() {
|
JCheckBox getModifiedCheckBox() {
|
||||||
@ -157,11 +127,9 @@ class DateSearchPanel extends javax.swing.JPanel {
|
|||||||
|
|
||||||
private void setComponentsEnabled() {
|
private void setComponentsEnabled() {
|
||||||
boolean enable = this.dateCheckBox.isSelected();
|
boolean enable = this.dateCheckBox.isSelected();
|
||||||
this.dateFromTextField.setEnabled(enable);
|
this.fromDatePicker.setEnabled(enable);
|
||||||
this.dateFromButtonCalendar.setEnabled(enable);
|
|
||||||
this.jLabel1.setEnabled(enable);
|
this.jLabel1.setEnabled(enable);
|
||||||
this.dateToTextField.setEnabled(enable);
|
this.toDatePicker.setEnabled(enable);
|
||||||
this.dateToButtonCalendar.setEnabled(enable);
|
|
||||||
this.jLabel2.setEnabled(enable);
|
this.jLabel2.setEnabled(enable);
|
||||||
this.jLabel3.setEnabled(enable);
|
this.jLabel3.setEnabled(enable);
|
||||||
this.jLabel4.setEnabled(enable);
|
this.jLabel4.setEnabled(enable);
|
||||||
@ -186,21 +154,19 @@ class DateSearchPanel extends javax.swing.JPanel {
|
|||||||
copyMenuItem = new javax.swing.JMenuItem();
|
copyMenuItem = new javax.swing.JMenuItem();
|
||||||
pasteMenuItem = new javax.swing.JMenuItem();
|
pasteMenuItem = new javax.swing.JMenuItem();
|
||||||
selectAllMenuItem = new javax.swing.JMenuItem();
|
selectAllMenuItem = new javax.swing.JMenuItem();
|
||||||
dateToTextField = new JFormattedTextField(this.dateFormat);
|
|
||||||
jLabel1 = new javax.swing.JLabel();
|
jLabel1 = new javax.swing.JLabel();
|
||||||
jLabel4 = new javax.swing.JLabel();
|
jLabel4 = new javax.swing.JLabel();
|
||||||
dateCheckBox = new javax.swing.JCheckBox();
|
dateCheckBox = new javax.swing.JCheckBox();
|
||||||
timeZoneComboBox = new JComboBox<>(this.timeZones.toArray(new String[this.timeZones.size()]));
|
timeZoneComboBox = new JComboBox<>(this.timeZones.toArray(new String[this.timeZones.size()]));
|
||||||
timeZoneComboBox.setRenderer(new DateSearchFilter.ComboBoxRenderer());
|
timeZoneComboBox.setRenderer(new DateSearchFilter.ComboBoxRenderer());
|
||||||
jLabel3 = new javax.swing.JLabel();
|
jLabel3 = new javax.swing.JLabel();
|
||||||
dateFromTextField = new JFormattedTextField(this.dateFormat);
|
|
||||||
jLabel2 = new javax.swing.JLabel();
|
jLabel2 = new javax.swing.JLabel();
|
||||||
modifiedCheckBox = new javax.swing.JCheckBox();
|
modifiedCheckBox = new javax.swing.JCheckBox();
|
||||||
changedCheckBox = new javax.swing.JCheckBox();
|
changedCheckBox = new javax.swing.JCheckBox();
|
||||||
accessedCheckBox = new javax.swing.JCheckBox();
|
accessedCheckBox = new javax.swing.JCheckBox();
|
||||||
createdCheckBox = new javax.swing.JCheckBox();
|
createdCheckBox = new javax.swing.JCheckBox();
|
||||||
dateFromButtonCalendar = new org.jbundle.thin.base.screen.jcalendarbutton.JCalendarButton();
|
fromDatePicker = new DatePicker(fromDateSettings);
|
||||||
dateToButtonCalendar = new org.jbundle.thin.base.screen.jcalendarbutton.JCalendarButton();
|
toDatePicker = new DatePicker(toDateSettings);
|
||||||
|
|
||||||
cutMenuItem.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.cutMenuItem.text")); // NOI18N
|
cutMenuItem.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.cutMenuItem.text")); // NOI18N
|
||||||
rightClickMenu.add(cutMenuItem);
|
rightClickMenu.add(cutMenuItem);
|
||||||
@ -214,14 +180,6 @@ class DateSearchPanel extends javax.swing.JPanel {
|
|||||||
selectAllMenuItem.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.selectAllMenuItem.text")); // NOI18N
|
selectAllMenuItem.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.selectAllMenuItem.text")); // NOI18N
|
||||||
rightClickMenu.add(selectAllMenuItem);
|
rightClickMenu.add(selectAllMenuItem);
|
||||||
|
|
||||||
dateToTextField.setEditable(false);
|
|
||||||
dateToTextField.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.dateToTextField.text")); // NOI18N
|
|
||||||
dateToTextField.addFocusListener(new java.awt.event.FocusAdapter() {
|
|
||||||
public void focusLost(java.awt.event.FocusEvent evt) {
|
|
||||||
dateToTextFieldFocusLost(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jLabel1.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.jLabel1.text")); // NOI18N
|
jLabel1.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.jLabel1.text")); // NOI18N
|
||||||
|
|
||||||
jLabel4.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.jLabel4.text")); // NOI18N
|
jLabel4.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.jLabel4.text")); // NOI18N
|
||||||
@ -236,14 +194,6 @@ class DateSearchPanel extends javax.swing.JPanel {
|
|||||||
jLabel3.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
|
jLabel3.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
|
||||||
jLabel3.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.jLabel3.text")); // NOI18N
|
jLabel3.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.jLabel3.text")); // NOI18N
|
||||||
|
|
||||||
dateFromTextField.setEditable(false);
|
|
||||||
dateFromTextField.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.dateFromTextField.text")); // NOI18N
|
|
||||||
dateFromTextField.addFocusListener(new java.awt.event.FocusAdapter() {
|
|
||||||
public void focusLost(java.awt.event.FocusEvent evt) {
|
|
||||||
dateFromTextFieldFocusLost(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
|
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
|
||||||
jLabel2.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.jLabel2.text")); // NOI18N
|
jLabel2.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.jLabel2.text")); // NOI18N
|
||||||
|
|
||||||
@ -279,44 +229,20 @@ class DateSearchPanel extends javax.swing.JPanel {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dateFromButtonCalendar.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.dateFromButtonCalendar.text")); // NOI18N
|
fromDatePicker.setAutoscrolls(true);
|
||||||
dateFromButtonCalendar.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
|
|
||||||
public void propertyChange(java.beans.PropertyChangeEvent evt) {
|
|
||||||
dateFromPopupChanged(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
dateToButtonCalendar.setText(org.openide.util.NbBundle.getMessage(DateSearchPanel.class, "DateSearchPanel.dateToButtonCalendar.text")); // NOI18N
|
toDatePicker.setAutoscrolls(true);
|
||||||
dateToButtonCalendar.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
|
|
||||||
public void propertyChange(java.beans.PropertyChangeEvent evt) {
|
|
||||||
dateToPopupChanged(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
this.setLayout(layout);
|
this.setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
.addContainerGap()
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addComponent(jLabel2)
|
||||||
.addComponent(dateCheckBox)
|
.addGap(18, 18, 18)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addComponent(jLabel3)
|
||||||
.addComponent(dateFromTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||||
.addGap(0, 0, 0)
|
|
||||||
.addComponent(dateFromButtonCalendar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
|
||||||
.addComponent(jLabel1)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
|
||||||
.addComponent(dateToTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(0, 0, 0)
|
|
||||||
.addComponent(dateToButtonCalendar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
||||||
.addContainerGap()
|
|
||||||
.addComponent(jLabel2)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addComponent(jLabel3)))
|
|
||||||
.addContainerGap(26, Short.MAX_VALUE))
|
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
.addGap(0, 0, Short.MAX_VALUE)
|
.addGap(0, 0, Short.MAX_VALUE)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
@ -333,23 +259,28 @@ class DateSearchPanel extends javax.swing.JPanel {
|
|||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(changedCheckBox)))
|
.addComponent(changedCheckBox)))
|
||||||
.addGap(33, 33, 33))
|
.addGap(33, 33, 33))
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addComponent(dateCheckBox)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
.addComponent(fromDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addGap(10, 10, 10)
|
||||||
|
.addComponent(toDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addContainerGap())
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addComponent(dateCheckBox)
|
||||||
.addComponent(dateCheckBox)
|
|
||||||
.addComponent(dateFromTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGap(18, 18, 18))
|
.addGap(18, 18, 18))
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(dateToButtonCalendar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(jLabel1)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addComponent(fromDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(jLabel1)
|
.addComponent(toDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addComponent(dateToTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addComponent(dateFromButtonCalendar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(jLabel3)
|
.addComponent(jLabel3)
|
||||||
@ -369,45 +300,6 @@ class DateSearchPanel extends javax.swing.JPanel {
|
|||||||
);
|
);
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
private void dateFromTextFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_dateFromTextFieldFocusLost
|
|
||||||
// set the "from" calendar button to listen to change in the text field
|
|
||||||
String fromDateString = this.dateFromTextField.getText();
|
|
||||||
if (!fromDateString.equals("")) {
|
|
||||||
try {
|
|
||||||
Date fromDate = dateFormat.parse(fromDateString);
|
|
||||||
dateFromButtonCalendar.setTargetDate(fromDate);
|
|
||||||
} catch (ParseException ex) {
|
|
||||||
// for now, no need to show the error message to the user her
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_dateFromTextFieldFocusLost
|
|
||||||
|
|
||||||
private void dateToTextFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_dateToTextFieldFocusLost
|
|
||||||
// set the "to" calendar button to listen to change in the text field
|
|
||||||
String toDateString = this.dateToTextField.getText();
|
|
||||||
if (!toDateString.equals("")) {
|
|
||||||
try {
|
|
||||||
Date toDate = dateFormat.parse(toDateString);
|
|
||||||
dateToButtonCalendar.setTargetDate(toDate);
|
|
||||||
} catch (ParseException ex) {
|
|
||||||
// for now, no need to show the error message to the user here
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_dateToTextFieldFocusLost
|
|
||||||
|
|
||||||
private void dateFromPopupChanged(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_dateFromPopupChanged
|
|
||||||
if (evt.getNewValue() instanceof Date) {
|
|
||||||
setFromDate((Date) evt.getNewValue());
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_dateFromPopupChanged
|
|
||||||
|
|
||||||
private void dateToPopupChanged(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_dateToPopupChanged
|
|
||||||
if (evt.getNewValue() instanceof Date) {
|
|
||||||
setToDate((Date) evt.getNewValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
}//GEN-LAST:event_dateToPopupChanged
|
|
||||||
|
|
||||||
private void dateCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dateCheckBoxActionPerformed
|
private void dateCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dateCheckBoxActionPerformed
|
||||||
this.setComponentsEnabled();
|
this.setComponentsEnabled();
|
||||||
firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
|
firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
|
||||||
@ -428,36 +320,6 @@ class DateSearchPanel extends javax.swing.JPanel {
|
|||||||
private void changedCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changedCheckBoxActionPerformed
|
private void changedCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changedCheckBoxActionPerformed
|
||||||
firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
|
firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
|
||||||
}//GEN-LAST:event_changedCheckBoxActionPerformed
|
}//GEN-LAST:event_changedCheckBoxActionPerformed
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate and set the datetime field on the screen given a datetime
|
|
||||||
* string.
|
|
||||||
*
|
|
||||||
* @param date The date object
|
|
||||||
*/
|
|
||||||
private void setFromDate(Date date) {
|
|
||||||
String dateStringResult = "";
|
|
||||||
if (date != null) {
|
|
||||||
dateStringResult = dateFormat.format(date);
|
|
||||||
}
|
|
||||||
|
|
||||||
dateFromTextField.setText(dateStringResult);
|
|
||||||
dateFromButtonCalendar.setTargetDate(date);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate and set the datetime field on the screen given a date.
|
|
||||||
*
|
|
||||||
* @param date The date object
|
|
||||||
*/
|
|
||||||
private void setToDate(Date date) {
|
|
||||||
String dateStringResult = "";
|
|
||||||
if (date != null) {
|
|
||||||
dateStringResult = dateFormat.format(date);
|
|
||||||
}
|
|
||||||
dateToTextField.setText(dateStringResult);
|
|
||||||
dateToButtonCalendar.setTargetDate(date);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isValidSearch() {
|
boolean isValidSearch() {
|
||||||
return this.accessedCheckBox.isSelected() ||
|
return this.accessedCheckBox.isSelected() ||
|
||||||
@ -472,10 +334,7 @@ class DateSearchPanel extends javax.swing.JPanel {
|
|||||||
private javax.swing.JCheckBox createdCheckBox;
|
private javax.swing.JCheckBox createdCheckBox;
|
||||||
private javax.swing.JMenuItem cutMenuItem;
|
private javax.swing.JMenuItem cutMenuItem;
|
||||||
private javax.swing.JCheckBox dateCheckBox;
|
private javax.swing.JCheckBox dateCheckBox;
|
||||||
private org.jbundle.thin.base.screen.jcalendarbutton.JCalendarButton dateFromButtonCalendar;
|
private com.github.lgooddatepicker.components.DatePicker fromDatePicker;
|
||||||
private javax.swing.JFormattedTextField dateFromTextField;
|
|
||||||
private org.jbundle.thin.base.screen.jcalendarbutton.JCalendarButton dateToButtonCalendar;
|
|
||||||
private javax.swing.JFormattedTextField dateToTextField;
|
|
||||||
private javax.swing.JLabel jLabel1;
|
private javax.swing.JLabel jLabel1;
|
||||||
private javax.swing.JLabel jLabel2;
|
private javax.swing.JLabel jLabel2;
|
||||||
private javax.swing.JLabel jLabel3;
|
private javax.swing.JLabel jLabel3;
|
||||||
@ -485,10 +344,17 @@ class DateSearchPanel extends javax.swing.JPanel {
|
|||||||
private javax.swing.JPopupMenu rightClickMenu;
|
private javax.swing.JPopupMenu rightClickMenu;
|
||||||
private javax.swing.JMenuItem selectAllMenuItem;
|
private javax.swing.JMenuItem selectAllMenuItem;
|
||||||
private javax.swing.JComboBox<String> timeZoneComboBox;
|
private javax.swing.JComboBox<String> timeZoneComboBox;
|
||||||
|
private com.github.lgooddatepicker.components.DatePicker toDatePicker;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
void addActionListener(ActionListener l) {
|
void addDateChangeListener() {
|
||||||
dateFromTextField.addActionListener(l);
|
DateChangeListener dcl = (DateChangeEvent event) -> {
|
||||||
dateToTextField.addActionListener(l);
|
firePropertyChange(FileSearchPanel.EVENT.CHECKED.toString(), null, null);
|
||||||
|
};
|
||||||
|
|
||||||
|
fromDatePicker.addDateChangeListener(dcl);
|
||||||
|
toDatePicker.addDateChangeListener(dcl);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user