View Javadoc
1   package nl.tudelft.simulation.dsol.web.animation.d2;
2   
3   import nl.tudelft.simulation.dsol.animation.Locatable;
4   
5   /**
6    * ToggleButtonInfo.java.
7    * <p>
8    * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
9    * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
10   * </p>
11   * @author <a href="https://github.com/averbraeck" target="_blank">Alexander Verbraeck</a>
12   */
13  public class ToggleButtonInfo
14  {
15      /** the name of the button. */
16      private final String name;
17  
18      /** whether the class is shown or not. */
19      private boolean visible;
20  
21      /**
22       * @param name String; the name of the button
23       * @param visible boolean; whether the class is initially shown or not
24       */
25      protected ToggleButtonInfo(String name, boolean visible)
26      {
27          this.name = name;
28          this.visible = visible;
29      }
30  
31      /**
32       * @return visible
33       */
34      public final boolean isVisible()
35      {
36          return this.visible;
37      }
38  
39      /**
40       * @param visible set visible
41       */
42      public final void setVisible(boolean visible)
43      {
44          this.visible = visible;
45      }
46  
47      /**
48       * @return name
49       */
50      public final String getName()
51      {
52          return this.name;
53      }
54  
55      /**
56       * ToggleButtonInfo.LocatableClass. <br>
57       * <br>
58       * Copyright (c) 2003-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved.
59       * See for project information <a href="https://www.simulation.tudelft.nl/" target="_blank">www.simulation.tudelft.nl</a>.
60       * The source code and binary code of this software is proprietary information of Delft University of Technology.
61       * @author <a href="https://github.com/averbraeck" target="_blank">Alexander Verbraeck</a>
62       */
63      public static class LocatableClass extends ToggleButtonInfo
64      {
65          /** the class for which the button holds (e.g., GTU.class). */
66          private final Class<? extends Locatable> locatableClass;
67  
68          /** the tool tip text to show when hovering over the button. */
69          private final String toolTipText;
70  
71          /**
72           * @param name String; the name of the button
73           * @param locatableClass Class&lt;? extends Locatable&gt;; the class for which the button holds (e.g., GTU.class)
74           * @param toolTipText String; the tool tip text to show when hovering over the button
75           * @param visible boolean; whether the class is initially shown or not
76           */
77          public LocatableClass(String name, Class<? extends Locatable> locatableClass, String toolTipText, boolean visible)
78          {
79              super(name, visible);
80              this.locatableClass = locatableClass;
81              this.toolTipText = toolTipText;
82          }
83  
84          /**
85           * @return locatableClass
86           */
87          public final Class<? extends Locatable> getLocatableClass()
88          {
89              return this.locatableClass;
90          }
91  
92          /**
93           * @return toolTipText
94           */
95          public final String getToolTipText()
96          {
97              return this.toolTipText;
98          }
99      }
100 
101     /**
102      * ToggleButtonInfo.Text. <br>
103      * <br>
104      * Copyright (c) 2003-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved.
105      * See for project information <a href="https://www.simulation.tudelft.nl/" target="_blank">www.simulation.tudelft.nl</a>.
106      * The source code and binary code of this software is proprietary information of Delft University of Technology.
107      * @author <a href="https://github.com/averbraeck" target="_blank">Alexander Verbraeck</a>
108      */
109     public static class Text extends ToggleButtonInfo
110     {
111         /**
112          * @param name String; the name of the button
113          * @param visible boolean; whether the class is initially shown or not
114          */
115         public Text(String name, boolean visible)
116         {
117             super(name, visible);
118         }
119     }
120 
121     /**
122      * ToggleButtonInfo.Gis. <br>
123      * <br>
124      * Copyright (c) 2003-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved.
125      * See for project information <a href="https://www.simulation.tudelft.nl/" target="_blank">www.simulation.tudelft.nl</a>.
126      * The source code and binary code of this software is proprietary information of Delft University of Technology.
127      * @author <a href="https://github.com/averbraeck" target="_blank">Alexander Verbraeck</a>
128      */
129     public static class Gis extends ToggleButtonInfo
130     {
131         /** the GIS layer name. */
132         private final String layerName;
133 
134         /** the tool tip text to show when hovering over the button. */
135         private final String toolTipText;
136 
137         /**
138          * @param name String; the name of the button
139          * @param layerName String; the GIS layer name
140          * @param toolTipText String; the tool tip text to show when hovering over the button
141          * @param visible boolean; whether the class is initially shown or not
142          */
143         public Gis(String name, String layerName, String toolTipText, boolean visible)
144         {
145             super(name, visible);
146             this.layerName = layerName;
147             this.toolTipText = toolTipText;
148         }
149 
150         /**
151          * @return layerName
152          */
153         public final String getLayerName()
154         {
155             return this.layerName;
156         }
157 
158         /**
159          * @return toolTipText
160          */
161         public final String getToolTipText()
162         {
163             return this.toolTipText;
164         }
165     }
166 
167 }