View Javadoc
1   /*
2    * Tethys: GUI Utilities
3    * Copyright 2012-2026. Tony Washer
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6    * use this file except in compliance with the License.  You may obtain a copy
7    * of the License at
8    *
9    *   http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
14   * License for the specific language governing permissions and limitations under
15   * the License.
16   */
17  package io.github.tonywasher.joceanus.tethys.api.button;
18  
19  import io.github.tonywasher.joceanus.oceanus.date.OceanusDate;
20  import io.github.tonywasher.joceanus.oceanus.date.OceanusDateConfig;
21  import io.github.tonywasher.joceanus.oceanus.event.OceanusEventRegistrar.OceanusEventProvider;
22  import io.github.tonywasher.joceanus.tethys.api.base.TethysUIComponent;
23  import io.github.tonywasher.joceanus.tethys.api.base.TethysUIEvent;
24  import io.github.tonywasher.joceanus.tethys.api.control.TethysUIControl.TethysUIDateButton;
25  
26  /**
27   * DateButton Manager.
28   * <p>
29   * The EventProvider fires the following events.
30   * <ul>
31   *   <li>TethysUIEvent.NEWVALUE is fired when a new date value is selected.
32   *   <li>TethysUIEvent.EDITFOCUSLOST is fired when the dialog is cancelled without a value being selected.
33   * </ul>
34   */
35  public interface TethysUIDateButtonManager
36          extends TethysUIDateButton, OceanusEventProvider<TethysUIEvent>, TethysUIComponent {
37      /**
38       * Obtain the configuration.
39       *
40       * @return the configuration
41       */
42      OceanusDateConfig getConfig();
43  
44      /**
45       * Obtain the selected Date.
46       *
47       * @return the selected Date
48       */
49      OceanusDate getSelectedDate();
50  
51      /**
52       * Obtain the earliest Date.
53       *
54       * @return the earliest Date
55       */
56      OceanusDate getEarliestDate();
57  
58      /**
59       * Obtain the latest Date.
60       *
61       * @return the latest Date
62       */
63      OceanusDate getLatestDate();
64  
65      /**
66       * Set selected Date.
67       *
68       * @param pDate the selected date
69       */
70      void setSelectedDate(OceanusDate pDate);
71  
72      /**
73       * Get button text.
74       *
75       * @return the text
76       */
77      String getText();
78  
79      /**
80       * Set earliest Date.
81       *
82       * @param pDate the earliest date
83       */
84      void setEarliestDate(OceanusDate pDate);
85  
86      /**
87       * Set latest Date.
88       *
89       * @param pDate the latest date
90       */
91      void setLatestDate(OceanusDate pDate);
92  
93      /**
94       * Allow Null Date selection.
95       *
96       * @return true/false
97       */
98      boolean allowNullDateSelection();
99  
100     /**
101      * Allow null date selection. If this flag is set an additional button will be displayed
102      * allowing the user to explicitly select no date, thus setting the SelectedDate to null.
103      *
104      * @param pAllowNullDateSelection true/false
105      */
106     void setAllowNullDateSelection(boolean pAllowNullDateSelection);
107 
108     /**
109      * Show Narrow Days. If this flag is set Days are show in narrow rather than short form.
110      *
111      * @param pShowNarrowDays true/false
112      */
113     void setShowNarrowDays(boolean pShowNarrowDays);
114 }