Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.filter
Class DateVisualFilter

java.lang.Object
  extended by com.citra.filter.VisualFilter
      extended by com.citra.filter.DateVisualFilter

public class DateVisualFilter
extends VisualFilter

A VisualFilter for Date values. A textfield is used to show the date pattern. If the textfield is clicked with the mouse, a dialog is invoked, through which the date pattern can be selected.


Field Summary
protected  JDateChooser dateChooser
          the datechooser that is contained in the dialog
protected  DateFilter dateFilter
          a date filter object used to filter Date values.
protected  Date dateShown
          the selected date
protected  DateFormat df
          the dateformat instance that is used to format the current date shown on the textfield.
protected  JDialog dialog
          the dialog that is invoked for inputting the date pattern
protected  JTextField expression
          a textfield used to show and input the date pattern.
protected  JComboBox expressionBox
          the combo box populated with the available filter values
protected  JComboBox fieldBoxOptions
          a combobox containing the filter options.
protected  JLabel filterLabel
          the label between the filter options combo box and the expression
protected  JCheckBox ignoreTime
          a checkbox used to denote whether time differences should be considered when filtering.
protected  boolean selectCurrentDateIfNull
          flag that indicates whether the current date should be selected when showing the date dialog, if there is no selection date.
protected  boolean useComboBox
          flag that controls whether a text field or a combo box is used to enter filter values
protected  boolean useComparisonText
          flag that controls whether to display comparison texts or symbols
 
Fields inherited from class com.citra.filter.VisualFilter
anyKey, filterModel
 
Constructor Summary
DateVisualFilter()
          Constructs a DateVisualFilter.
DateVisualFilter(boolean useComboBox)
          Constructs a DateVisualFilter.
 
Method Summary
protected  void bringUpDialog()
          Displays the date chooser dialog
 void fireFilter()
          Generates and forwards a filter event to the listeners of the filter model.
 JDateChooser getDateChooser()
          Returns the date chooser that is shown to the user.
 DateFormat getDateFormat()
          Returns the dateformat object associated with this date visual filter.
 JTextField getExpression()
          Returns a textfield that is used to display and allow input of the date pattern.
 JComboBox getExpressionBox()
          Retrieves the combo box that provides the available filter values.
 JComboBox getFieldBoxOptions()
          Returns a combobox containing the filter options.
 Filter getFilter()
          Returns the filter object that this component uses to filter the values.
 JLabel getFilterLabel()
          Returns a label between the filter options combo box and the expression textfield.
 JCheckBox getIgnoreTime()
          Returns a checkbox that is used to show whether time differences should be considered when filtering.
 JPanel getPanel()
          Returns the panel containing the controls used to manipulate the filter.
 boolean getSelectCurrentDateIfNull()
          Determines whether to select the current date when the date chooser is displayed, if the selected date is null.
 TableFilter getTableFilter()
          Returns a table filter object corresponding to the visual controls of the filter.
 boolean getUseComboBox()
          Determines whether a text field or a combo box is used to enter filter values.
 boolean getUseComparisonText()
          Determines whether to display comparison texts or symbols.
 void setDate(Date d)
          Assigns the supplied date to the expression text field and to the date filter of this visual filter.
 void setDateFormat(DateFormat dateFormat)
          Assigns a new dateformat.
 void setFilter(Filter filter)
          Assigns a filter object that this component uses to filter the values.
 void setSelectCurrentDateIfNull(boolean selectCurrentDateIfNull)
          Determines whether to select the current date when the date chooser is displayed, if the selected date is null.
 void setTableFilter(TableFilter tf)
          This method should modify the visual control's values to those corresponding to the supplied TableFilter object.
 void setUseComboBox(boolean useComboBox)
          Determines whether a text field or a combo box is used to enter filter values.
 void setUseComparisonText(boolean useComparisonText)
          Determines whether to display comparison texts or symbols.
 boolean shouldApplyFilter()
          Returns true if the current filter should be applied, false otherwise.
 
Methods inherited from class com.citra.filter.VisualFilter
getFilterModel, getFilterOnKey, setFilterOnKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

selectCurrentDateIfNull

protected boolean selectCurrentDateIfNull
flag that indicates whether the current date should be selected when showing the date dialog, if there is no selection date.


ignoreTime

protected JCheckBox ignoreTime
a checkbox used to denote whether time differences should be considered when filtering.


fieldBoxOptions

protected JComboBox fieldBoxOptions
a combobox containing the filter options.


expression

protected JTextField expression
a textfield used to show and input the date pattern.


dateFilter

protected DateFilter dateFilter
a date filter object used to filter Date values.


dateChooser

protected JDateChooser dateChooser
the datechooser that is contained in the dialog


dialog

protected JDialog dialog
the dialog that is invoked for inputting the date pattern


dateShown

protected Date dateShown
the selected date


filterLabel

protected JLabel filterLabel
the label between the filter options combo box and the expression


df

protected DateFormat df
the dateformat instance that is used to format the current date shown on the textfield.


expressionBox

protected JComboBox expressionBox
the combo box populated with the available filter values


useComboBox

protected boolean useComboBox
flag that controls whether a text field or a combo box is used to enter filter values


useComparisonText

protected boolean useComparisonText
flag that controls whether to display comparison texts or symbols

Constructor Detail

DateVisualFilter

public DateVisualFilter()
Constructs a DateVisualFilter.


DateVisualFilter

public DateVisualFilter(boolean useComboBox)
Constructs a DateVisualFilter.

Method Detail

bringUpDialog

protected void bringUpDialog()
Displays the date chooser dialog


fireFilter

public void fireFilter()
Generates and forwards a filter event to the listeners of the filter model. The filter event is initialized with a TableFilter taken by calling the getTableFilter() method.

Overrides:
fireFilter in class VisualFilter

getDateChooser

public JDateChooser getDateChooser()
Returns the date chooser that is shown to the user.

Returns:
the date chooser panel

getDateFormat

public DateFormat getDateFormat()
Returns the dateformat object associated with this date visual filter.

Returns:
the internal date format object.

getExpression

public JTextField getExpression()
Returns a textfield that is used to display and allow input of the date pattern.

Returns:
the 'date' text field.

getExpressionBox

public JComboBox getExpressionBox()
Retrieves the combo box that provides the available filter values.

Returns:
the combo box populated with the available filter values

getFieldBoxOptions

public JComboBox getFieldBoxOptions()
Returns a combobox containing the filter options.

Returns:
the 'filter' combobox.

getFilter

public Filter getFilter()
Returns the filter object that this component uses to filter the values.

Specified by:
getFilter in class VisualFilter
Returns:
a filter

getFilterLabel

public JLabel getFilterLabel()
Returns a label between the filter options combo box and the expression textfield.

Returns:
the 'filter' label.

getIgnoreTime

public JCheckBox getIgnoreTime()
Returns a checkbox that is used to show whether time differences should be considered when filtering.

Returns:
the 'ignore time' checkbox.

getPanel

public JPanel getPanel()
Returns the panel containing the controls used to manipulate the filter.

Specified by:
getPanel in class VisualFilter
Returns:
a panel with controls used in filtering.

getSelectCurrentDateIfNull

public boolean getSelectCurrentDateIfNull()
Determines whether to select the current date when the date chooser is displayed, if the selected date is null.

Returns:
true, if the current date is to be set, false otherwise

getTableFilter

public TableFilter getTableFilter()
Returns a table filter object corresponding to the visual controls of the filter.

Specified by:
getTableFilter in class VisualFilter
Returns:
a table filter

getUseComparisonText

public boolean getUseComparisonText()
Determines whether to display comparison texts or symbols.

Returns:
true if texts are used, false if symbols

getUseComboBox

public boolean getUseComboBox()
Determines whether a text field or a combo box is used to enter filter values.

Returns:
true, if a combo box is used, or false, in the case of a text field

setDate

public void setDate(Date d)
Assigns the supplied date to the expression text field and to the date filter of this visual filter.

Parameters:
d - the date object to assign

setDateFormat

public void setDateFormat(DateFormat dateFormat)
Assigns a new dateformat.

Parameters:
dateFormat - the date format object to assign

setUseComboBox

public void setUseComboBox(boolean useComboBox)
Determines whether a text field or a combo box is used to enter filter values.

Parameters:
useComboBox - true if a combo box is used, or false, in the case of a text field

setFilter

public void setFilter(Filter filter)
Assigns a filter object that this component uses to filter the values.

Specified by:
setFilter in class VisualFilter
Parameters:
filter - the filter to assign

setSelectCurrentDateIfNull

public void setSelectCurrentDateIfNull(boolean selectCurrentDateIfNull)
Determines whether to select the current date when the date chooser is displayed, if the selected date is null.

Parameters:
selectCurrentDateIfNull - true, if the current date is to be set, false otherwise

setTableFilter

public void setTableFilter(TableFilter tf)
This method should modify the visual control's values to those corresponding to the supplied TableFilter object.

Specified by:
setTableFilter in class VisualFilter
Parameters:
tf - the TableFilter to set.

setUseComparisonText

public void setUseComparisonText(boolean useComparisonText)
Determines whether to display comparison texts or symbols.

Parameters:
useComparisonText - true if texts are used, false if symbols

shouldApplyFilter

public boolean shouldApplyFilter()
Returns true if the current filter should be applied, false otherwise. Sometimes, can opt NOT to filter, e.g. if a number or a date is not parseable.

Specified by:
shouldApplyFilter in class VisualFilter
Returns:
true if the filter should be applied

Copyright © 2011 Citra Technologies. All Rights Reserved.