View Javadoc
1   package org.jdatepicker;
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.awt.*;
28  import java.util.HashMap;
29  import java.util.Map;
30  
31  /**
32   * Component Color
33   * Created by Ludovic on 20/11/2015.
34   */
35  public abstract class AbstractComponentColor {
36  
37      public enum Key {
38          FG_MONTH_SELECTOR,
39          BG_MONTH_SELECTOR,
40          FG_GRID_HEADER,
41          BG_GRID_HEADER,
42          FG_GRID_THIS_MONTH,
43          FG_GRID_OTHER_MONTH,
44          FG_GRID_TODAY,
45          BG_GRID,
46          BG_GRID_NOT_SELECTABLE,
47          FG_GRID_SELECTED,
48          BG_GRID_SELECTED,
49          FG_GRID_TODAY_SELECTED,
50          BG_GRID_TODAY_SELECTED,
51          FG_TODAY_SELECTOR_ENABLED,
52          FG_TODAY_SELECTOR_DISABLED,
53          BG_TODAY_SELECTOR,
54          POPUP_BORDER
55      }
56  
57      protected final Map<Key, Color> colors;
58  
59      /**
60       * <p>Constructor for AbstractComponentColor.</p>
61       */
62      public AbstractComponentColor() {
63          colors = new HashMap<>();
64      }
65  
66      /**
67       * <p>getColor.</p>
68       *
69       * @param key a {@link org.jdatepicker.AbstractComponentColor.Key} object.
70       * @return a {@link java.awt.Color} object.
71       */
72      public Color getColor(Key key) {
73          return colors.get(key);
74      }
75  
76      /**
77       * <p>setColor.</p>
78       *
79       * @param key a {@link org.jdatepicker.AbstractComponentColor.Key} object.
80       * @param color a {@link java.awt.Color} object.
81       */
82      public void setColor(Key key, Color color) {
83          colors.put(key, color);
84      }
85  
86  }