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.swing.button;
18  
19  import io.github.tonywasher.joceanus.tethys.core.button.TethysUICoreDateRangeSelector;
20  import io.github.tonywasher.joceanus.tethys.core.factory.TethysUICoreFactory;
21  import io.github.tonywasher.joceanus.tethys.swing.base.TethysUISwingNode;
22  
23  /**
24   * Selection panel to select a standard DatePeriod from within a range of dates.
25   */
26  public class TethysUISwingDateRangeSelector
27          extends TethysUICoreDateRangeSelector {
28      /**
29       * Constructor.
30       *
31       * @param pFactory     the GUI factory
32       * @param pBaseIsStart is the baseDate the start of the period? (true/false)
33       */
34      TethysUISwingDateRangeSelector(final TethysUICoreFactory<?> pFactory,
35                                     final boolean pBaseIsStart) {
36          /* Initialise the underlying class */
37          super(pFactory, pBaseIsStart);
38  
39          /* Create the full sub-panel */
40          applyState();
41      }
42  
43      @Override
44      public TethysUISwingNode getNode() {
45          return (TethysUISwingNode) getControl().getNode();
46      }
47  
48      @Override
49      public void setPreferredWidth(final Integer pWidth) {
50          getNode().setPreferredWidth(pWidth);
51      }
52  
53      @Override
54      public void setPreferredHeight(final Integer pHeight) {
55          getNode().setPreferredHeight(pHeight);
56      }
57  
58      @Override
59      public void setBorderPadding(final Integer pPadding) {
60          super.setBorderPadding(pPadding);
61          getNode().createWrapperPane(getBorderTitle(), getBorderPadding());
62      }
63  
64      @Override
65      public void setBorderTitle(final String pTitle) {
66          super.setBorderTitle(pTitle);
67          getNode().createWrapperPane(getBorderTitle(), getBorderPadding());
68      }
69  
70      @Override
71      public void setVisible(final boolean pVisible) {
72          getNode().setVisible(pVisible);
73      }
74  
75      @Override
76      public boolean isVisible() {
77          return getNode().isVisible();
78      }
79  }