001 /*
002 * This file is part of McIDAS-V
003 *
004 * Copyright 2007-2013
005 * Space Science and Engineering Center (SSEC)
006 * University of Wisconsin - Madison
007 * 1225 W. Dayton Street, Madison, WI 53706, USA
008 * https://www.ssec.wisc.edu/mcidas
009 *
010 * All Rights Reserved
011 *
012 * McIDAS-V is built on Unidata's IDV and SSEC's VisAD libraries, and
013 * some McIDAS-V source code is based on IDV and VisAD source code.
014 *
015 * McIDAS-V is free software; you can redistribute it and/or modify
016 * it under the terms of the GNU Lesser Public License as published by
017 * the Free Software Foundation; either version 3 of the License, or
018 * (at your option) any later version.
019 *
020 * McIDAS-V is distributed in the hope that it will be useful,
021 * but WITHOUT ANY WARRANTY; without even the implied warranty of
022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
023 * GNU Lesser Public License for more details.
024 *
025 * You should have received a copy of the GNU Lesser Public License
026 * along with this program. If not, see http://www.gnu.org/licenses.
027 */
028
029 package edu.wisc.ssec.mcidasv.data.dateChooser;
030
031 import java.beans.PropertyChangeListener;
032 import java.util.Date;
033 import java.util.Locale;
034
035 import javax.swing.JComponent;
036
037 /**
038 * All date editors that should be used by a JDateChooser have to implement this
039 * interface.
040 *
041 * @author Kai Toedter
042 * @version $LastChangedRevision: 105 $
043 * @version $LastChangedDate: 2007-02-16 12:56:29 +0100 (Fr, 16 Feb 2007) $
044 *
045 */
046 public interface IDateEditor {
047
048 /**
049 *
050 * Returns the date.
051 *
052 * @return the date
053 */
054 public Date getDate();
055
056 /**
057 * Sets the date. This should be implemented as a bound property, firing the
058 * "date" property.
059 *
060 * @param date
061 * the date to set
062 */
063 public void setDate(Date date);
064
065 /**
066 * Sets the date format string, e.g. "MM/dd/yy". If the date format string
067 * is null or invalid, the date format string will be set to the MEDIUM
068 * Simple date format of the current locale.
069 *
070 * @param dateFormatString
071 * the date format string
072 */
073 public void setDateFormatString(String dateFormatString);
074
075 /**
076 * Returns tha date format string.
077 *
078 * @return the date format string
079 */
080 public String getDateFormatString();
081
082 /**
083 * Sets a valid date range for selectable dates. If max is before
084 * min, the default range with no limitation is set.
085 *
086 * @param min
087 * the minimum selectable date or null (then the minimum date should be
088 * set to 01\01\0001)
089 * @param max
090 * the maximum selectable date or null (then the maximum date should be
091 * set to 01\01\9999)
092 */
093 public void setSelectableDateRange(Date min, Date max) ;
094
095 /**
096 * Gets the minimum selectable date.
097 *
098 * @return the minimum selectable date
099 */
100 public Date getMaxSelectableDate();
101
102 /**
103 * Gets the maximum selectable date.
104 *
105 * @return the maximum selectable date
106 */
107 public Date getMinSelectableDate();
108
109 /**
110 * Sets the maximum selectable date.
111 *
112 * @param max maximum selectable date
113 */
114 public void setMaxSelectableDate(Date max);
115
116 /**
117 * Sets the minimum selectable date.
118 *
119 * @param min minimum selectable date
120 */
121 public void setMinSelectableDate(Date min);
122
123 /**
124 * Returns the UI component, e.g. the actual JTextField implementing the
125 * editor.
126 *
127 * @return the UI component
128 */
129 public JComponent getUiComponent();
130
131 /**
132 * Sets the locale. Usually this should have impact on the current date
133 * format string.
134 *
135 * @param locale
136 * the locale to set
137 */
138 public void setLocale(Locale locale);
139
140 /**
141 * Enables or disables the UI compoment.
142 *
143 * @param enabled
144 * true, if the UI component should be enabled.
145 */
146 public void setEnabled(boolean enabled);
147
148 /**
149 * Adds a property change listener that should be added to the implementing
150 * UI component. The UI component should fire a "date" property if the date
151 * changes.
152 *
153 * @param listener
154 * the property change listener.
155 */
156 public void addPropertyChangeListener(PropertyChangeListener listener);
157
158 /**
159 * Adds a property change listener that should be added to the implementing
160 * UI component. The UI component should fire a "date" property if the date
161 * changes.
162 *
163 * @param propertyName
164 * the property name, e.g. "date"
165 * @param listener
166 * the property change listener.
167 */
168 public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener);
169
170 /**
171 * Removes a property change listener.
172 *
173 * @param listener
174 * the property change listener.
175 */
176 public void removePropertyChangeListener(PropertyChangeListener listener);
177
178 /**
179 * Removes the listener from the date editor's property change listeners for the specific property.
180 *
181 * @param propertyName
182 * the property to listen for, e.g. "date"
183 * @param listener
184 * the listener
185 */
186 public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);
187 }