1 package fr.ifremer.quadrige3.ui.swing.component.date;
2
3 /*
4 * #%L
5 * Reef DB :: UI
6 * $Id:$
7 * $HeadURL:$
8 * %%
9 * Copyright (C) 2014 - 2015 Ifremer
10 * %%
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Affero General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU Affero General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 * #L%
24 */
25
26
27 import java.text.DateFormat;
28 import java.util.HashMap;
29 import java.util.Map;
30
31 /**
32 * Component Format
33 * Created by Ludovic on 20/11/2015.
34 */
35 public abstract class AbstractComponentFormat {
36
37 public enum Key {
38 TODAY_SELECTOR,
39 DOW_HEADER,
40 MONTH_SELECTOR,
41 OUTPUT_DATE_FIELD,
42 INPUT_DATE_FIELD
43 }
44
45 protected final Map<Key, DateFormat> formats;
46
47 /**
48 * <p>Constructor for AbstractComponentFormat.</p>
49 */
50 public AbstractComponentFormat() {
51 formats = new HashMap<>();
52 }
53
54 /**
55 * <p>getFormat.</p>
56 *
57 * @param key a {@link AbstractComponentFormat.Key} object.
58 * @return a {@link java.text.DateFormat} object.
59 */
60 public DateFormat getFormat(Key key) {
61 return formats.get(key);
62 }
63
64 /**
65 * <p>setFormat.</p>
66 *
67 * @param key a {@link AbstractComponentFormat.Key} object.
68 * @param format a {@link java.text.DateFormat} object.
69 */
70 public void setFormat(Key key, DateFormat format) {
71 formats.put(key, format);
72 }
73
74 }