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.core.dialog;
18  
19  import io.github.tonywasher.joceanus.tethys.api.base.TethysUINode;
20  import io.github.tonywasher.joceanus.tethys.api.control.TethysUILabel;
21  import io.github.tonywasher.joceanus.tethys.api.dialog.TethysUIBusySpinner;
22  import io.github.tonywasher.joceanus.tethys.api.pane.TethysUIBoxPaneManager;
23  import io.github.tonywasher.joceanus.tethys.core.base.TethysUICoreComponent;
24  import io.github.tonywasher.joceanus.tethys.core.base.TethysUICoreIcon;
25  import io.github.tonywasher.joceanus.tethys.core.factory.TethysUICoreFactory;
26  
27  /**
28   * About Box.
29   */
30  public abstract class TethysUICoreBusySpinner
31          extends TethysUICoreComponent
32          implements TethysUIBusySpinner {
33      /**
34       * Spinner size.
35       */
36      protected static final int SPINNER_SIZE = 70;
37  
38      /**
39       * The panel.
40       */
41      private final TethysUIBoxPaneManager thePanel;
42  
43      /**
44       * Constructor.
45       *
46       * @param pFactory the GUI factory
47       */
48      protected TethysUICoreBusySpinner(final TethysUICoreFactory<?> pFactory) {
49          /* Create a new label for the spinner */
50          final TethysUILabel mySpinner = pFactory.controlFactory().newLabel();
51          mySpinner.setIconOnly();
52          mySpinner.setIconSize(SPINNER_SIZE);
53          mySpinner.setIcon(TethysUICoreIcon.DYNAMICSPINNER);
54  
55          /* Layout the panel */
56          thePanel = pFactory.paneFactory().newVBoxPane();
57          thePanel.addNode(mySpinner);
58      }
59  
60      @Override
61      public TethysUINode getNode() {
62          return thePanel.getNode();
63      }
64  
65      @Override
66      public void setEnabled(final boolean pEnabled) {
67          thePanel.setEnabled(pEnabled);
68      }
69  
70      @Override
71      public void setVisible(final boolean pVisible) {
72          thePanel.setVisible(pVisible);
73      }
74  
75      @Override
76      public Integer getId() {
77          return thePanel.getId();
78      }
79  }