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