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.javafx.button;
18  
19  import io.github.tonywasher.joceanus.tethys.core.button.TethysUICoreIconButtonManager;
20  import io.github.tonywasher.joceanus.tethys.core.factory.TethysUICoreFactory;
21  import io.github.tonywasher.joceanus.tethys.javafx.base.TethysUIFXNode;
22  
23  /**
24   * Simple button that displays icon.
25   *
26   * @param <T> the object type
27   */
28  public final class TethysUIFXIconButtonManager<T>
29          extends TethysUICoreIconButtonManager<T> {
30      /**
31       * Constructor.
32       *
33       * @param pFactory the GUI factory
34       * @param pClazz   the value class
35       */
36      TethysUIFXIconButtonManager(final TethysUICoreFactory<?> pFactory,
37                                  final Class<T> pClazz) {
38          /* Initialise underlying class */
39          super(pFactory, pClazz);
40      }
41  
42      @Override
43      public TethysUIFXNode getNode() {
44          return (TethysUIFXNode) super.getNode();
45      }
46  
47      @Override
48      public void setVisible(final boolean pVisible) {
49          getNode().setManaged(pVisible);
50          getNode().setVisible(pVisible);
51      }
52  
53      @Override
54      public void setPreferredWidth(final Integer pWidth) {
55          getNode().setPreferredWidth(pWidth);
56      }
57  
58      @Override
59      public void setPreferredHeight(final Integer pHeight) {
60          getNode().setPreferredHeight(pHeight);
61      }
62  
63      @Override
64      public void setBorderPadding(final Integer pPadding) {
65          super.setBorderPadding(pPadding);
66          getNode().createWrapperPane(getBorderTitle(), getBorderPadding());
67      }
68  
69      @Override
70      public void setBorderTitle(final String pTitle) {
71          super.setBorderTitle(pTitle);
72          getNode().createWrapperPane(getBorderTitle(), getBorderPadding());
73      }
74  }