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